Skip to content

Commit 586d4c3

Browse files
committed
use TargetOpts
1 parent 7ec7c90 commit 586d4c3

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

lib/Interpreter/CppInterOpInterpreter.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -412,18 +412,17 @@ class Interpreter {
412412
}
413413

414414
CompilationResult loadLibrary(const std::string& filename, bool lookup) {
415-
#ifdef __EMSCRIPTEN__
416-
if (lookup) {
417-
llvm::errs() << "[cppinterop] Warning: 'lookup' has no effect on WASM.\n";
418-
}
419-
// In WASM: directly use Interpreter's LoadDynamicLibrary
420-
if (auto Err = inner->LoadDynamicLibrary(filename.c_str())) {
421-
llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(),
422-
"loadLibrary: ");
423-
return kFailure;
415+
llvm::Triple triple(getCompilerInstance()->getTargetOpts().Triple);
416+
if (triple.isWasm()) {
417+
// On WASM, dlopen-style canonical lookup has no effect.
418+
if (auto Err = inner->LoadDynamicLibrary(filename.c_str())) {
419+
llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(),
420+
"loadLibrary: ");
421+
return kFailure;
422+
}
423+
return kSuccess;
424424
}
425-
return kSuccess;
426-
#endif
425+
427426
DynamicLibraryManager* DLM = getDynamicLibraryManager();
428427
std::string canonicalLib;
429428
if (lookup)

0 commit comments

Comments
 (0)