File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 18
18
#include " llvm/Support/VirtualFileSystem.h"
19
19
#ifdef __EMSCRIPTEN__
20
20
#include " Wasm.h"
21
+ #include < dlfcn.h>
21
22
#endif // __EMSCRIPTEN__
22
23
23
24
#include " clang/AST/ASTConsumer.h"
@@ -711,6 +712,14 @@ llvm::Error Interpreter::Undo(unsigned N) {
711
712
}
712
713
713
714
llvm::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
714
723
auto EE = getExecutionEngine ();
715
724
if (!EE)
716
725
return EE.takeError ();
@@ -722,6 +731,7 @@ llvm::Error Interpreter::LoadDynamicLibrary(const char *name) {
722
731
EE->getMainJITDylib ().addGenerator (std::move (*DLSG));
723
732
else
724
733
return DLSG.takeError ();
734
+ #endif
725
735
726
736
return llvm::Error::success ();
727
737
}
You can’t perform that action at this time.
0 commit comments