nagisa / rust_libloading

Bindings around the platform's dynamic library loading primitives with greatly improved memory safety.

Home Page:https://docs.rs/libloading

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Library is cached if loaded multiple times

TobiasGrothmann opened this issue · comments

Hi there,

I have a little bit of a special use-case and I don't know very much about loading dynamic libraries at runtime.

I am trying to:

  • Load a dylib at runtime -> works
  • get a function -> works
  • call said function and use its return value -> works

Now comes the part that doesn't work:

  • Compile a cargo project at runtime and generate a new dylib -> works
  • Load the library again -> not sure if that really works
  • get and call the changed function -> definitely doesn't work

The problem is, that I still somehow get the old function and get the old return value from it.
How can I force it to unload and reload the library?


Working on MacOS
libloading = "0.8.1"

This is a platform behaviour libloading can do nothing about. Please refer to the list of closed issues, for example #59.