File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 1818#include " llvm/Support/VirtualFileSystem.h"
1919#ifdef __EMSCRIPTEN__
2020#include " Wasm.h"
21+ #include < dlfcn.h>
2122#endif // __EMSCRIPTEN__
2223
2324#include " clang/AST/ASTConsumer.h"
@@ -711,6 +712,14 @@ llvm::Error Interpreter::Undo(unsigned N) {
711712}
712713
713714llvm::Error Interpreter::LoadDynamicLibrary (const char *name) {
715+ #ifdef __EMSCRIPTEN__
716+ void *handle = dlopen (name, RTLD_NOW | RTLD_GLOBAL);
717+ if (!handle) {
718+ llvm::errs () << dlerror () << ' \n ' ;
719+ return llvm::make_error<llvm::StringError>(" Failed to load dynamic library" ,
720+ llvm::inconvertibleErrorCode ());
721+ }
722+ #else
714723 auto EE = getExecutionEngine ();
715724 if (!EE)
716725 return EE.takeError ();
@@ -722,6 +731,7 @@ llvm::Error Interpreter::LoadDynamicLibrary(const char *name) {
722731 EE->getMainJITDylib ().addGenerator (std::move (*DLSG));
723732 else
724733 return DLSG.takeError ();
734+ #endif
725735
726736 return llvm::Error::success ();
727737}
You can’t perform that action at this time.
0 commit comments