rttrorg / rttr

C++ Reflection Library
https://www.rttr.org
MIT License
3.12k stars 430 forks source link

Provide stubs if dlfcn.h does not exist #302

Open TrevorSundberg opened 3 years ago

TrevorSundberg commented 3 years ago

For compiling under WebAssembly with the wasi-sdk / wasi-libc. Even though the platforms have many POSIX functions implemented, they do not have dlopen etc. This checks if the header exists, and if it does it includes it, otherwise it provides stubs that always return null / errors. If a compiler does not support __has_include, it will just include dlfcn.h as a fallback. Most (if not all) wasm platforms are using at least clang 9, which is when native wasm was added to clang, and they support __has_include.