Home > Back-end >  Is it possible to detect WASM compiler in code via compiler directives?
Is it possible to detect WASM compiler in code via compiler directives?

Time:03-18

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

CodePudding user response:

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.

  • Related