I can load my library, but I cannot unload it with
LibraryUnload. I do have a
void WolframLibrary_uninitialize(WolframLibraryData libData) (which does nothing). I get the following error:
LibraryFunction::unloadlib: The library "/my/library.so" cannot be unloaded.
I am not loading any function after loading the library. The OS is Linux x86_64.
I don't seem to be able to unload not even the demo library:
This gets me the same error.
As worked out by Szabolcs and halirutan, I need to load one function at least (
LibraryFunctionLoad) to have the initialization function called, and so being able to call
LibraryUnload successfully. Yet, my ultimate goal is to be able to reload a new build of the library: this seems impossible because calling
LibraryUnload doesn't actually close the handle of the library, and further calls to
LibraryFunctionLoad reuse it. I checked with
lsof, and if I delete the library and try to reload it I get that the new file is ignored and instead a handle to the old file (tagged correctly as
lsof) is kept.