是否可以通过编译器指令检测代码中的 WASM 编译器?
我是否可以在自己的 C++ 代码中检测到一个标准的 #define
来指示 WASM 是否正在编译代码?
在 Android 上的 C++ 中,我可以使用 #ifdef __ANDROID__
但我不确定 Web Assembly 是否适用?我实际上使用的是 emcc 编译器,所以也许 EMCC 编译器有一个标准的 #define
...
谢谢
Is there a standard #define
I can detect within my own C++ code that would indicate if WASM is compiling the code?
In C++ on Android I can use #ifdef __ANDROID__
but I'm not sure for Web Assembly ? I'm actually using emcc compiler so maybe there's a standard #define
for EMCC compiler...
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
__wasm__
来检测一般的 Wasm 架构,或者使用__wasm32__
/__wasm64__
来更精确地检测。或者您可以使用 __EMSCRIPTEN__ 来专门检测 emscripten 目标。You can use
__wasm__
to detect the Wasm architecture in general or__wasm32__
/__wasm64__
to be more precise. Or you can use__EMSCRIPTEN__
to specifically detect the emscripten target.