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

Anutosh Bhat via All-commits all-commits at lists.llvm.org
Tue Apr 29 15:55:01 PDT 2025


  Branch: refs/heads/release/20.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 8c2dc1b5aa7fc25d2083b60f04687f307bfc4e37
      https://github.com/llvm/llvm-project/commit/8c2dc1b5aa7fc25d2083b60f04687f307bfc4e37
  Author: Anutosh Bhat <andersonbhat491 at gmail.com>
  Date:   2025-04-29 (Tue, 29 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)

(cherry picked from commit 8f56394487a4d454be0637667267ad37bd636d0f)



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