[all-commits] [llvm/llvm-project] 8f5639: [clang-repl] Implement LoadDynamicLibrary for clan...

Anutosh Bhat via All-commits all-commits at lists.llvm.org
Tue Apr 1 05:34:41 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8f56394487a4d454be0637667267ad37bd636d0f
      https://github.com/llvm/llvm-project/commit/8f56394487a4d454be0637667267ad37bd636d0f
  Author: Anutosh Bhat <andersonbhat491 at gmail.com>
  Date:   2025-04-01 (Tue, 01 Apr 2025)

  Changed paths:
    M clang/lib/Interpreter/IncrementalExecutor.h
    M clang/lib/Interpreter/Interpreter.cpp
    M clang/lib/Interpreter/Wasm.cpp
    M clang/lib/Interpreter/Wasm.h

  Log Message:
  -----------
  [clang-repl] Implement LoadDynamicLibrary for clang-repl wasm use cases (#133037)

**Currently we don't make use of the JIT for the wasm use cases so the
approach using the execution engine won't work in these cases.**

Rather if we use dlopen. We should be able to do the following
(demonstrating through a toy project)

1) Make use of LoadDynamicLibrary through the given implementation

```
extern "C" EMSCRIPTEN_KEEPALIVE int load_library(const char *name) {
  auto Err = Interp->LoadDynamicLibrary(name);
  if (Err) {
    llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "load_library error: ");
    return -1;
  }
  return 0;
}
```
2) Add a button to call load_library once the library has been added in
our MEMFS (currently we have symengine built as a SIDE MODULE and we are
loading it)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list