You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
loading dylib from rust host program with libloading, recompiling dylib, reloading dylib does not see the new plugin version until the host fully restarts
#108
Closed
klebs6 opened this issue
Aug 11, 2022
· 2 comments
Greetings folks! I have been enjoying working with the library so far! I am encountering an unexpected behavioral error, though...
It is possible that there is some simple, obvious mistake in my setup and I will find it first thing in the morning!
I figured I would post here just in case there is somebody who might already know what to do.
I can add more detail after getting some sleep, but the basic gist is that I am writing a plugin (in rust) for a host (in rust), and am using the libloading library to handle the symbol loading etc at the interface.
Most everything seems to be working quite well -- the plugin loads on demand and the code executes as I expect it to.
However, when I need to make a change to the plugin and recompile it with cargo, reloading the dylib from the host does not seem to see the new changes. If I exit the host, relaunch the host, and load the plugin once more on demand, it picks up the new changes.
My first attempt at a solution was to manually call close on the libloading::Library after I am done using the plugin, before reloading it. That didn't seem to work, though it is possible I made a mistake.
I have not had a chance to inspect the situation more deeply, but am also not quite sure yet where to start...
I think getting some sleep might help! I am off to take care of that now! 😁😴 Thanks in advance for any help!
The text was updated successfully, but these errors were encountered:
Yeah, most likely reason is that the old library remains loaded for one reason or another and trying to load a new one just increments a reference count for the old one rather than loading a new one.
This can happen for various reasons depending on the platform being targeted so unfortunately there isn’t really a nice straightforward cross-platform solution to this.
Greetings folks! I have been enjoying working with the library so far! I am encountering an unexpected behavioral error, though...
It is possible that there is some simple, obvious mistake in my setup and I will find it first thing in the morning!
I figured I would post here just in case there is somebody who might already know what to do.
I can add more detail after getting some sleep, but the basic gist is that I am writing a plugin (in rust) for a host (in rust), and am using the
libloading
library to handle the symbol loading etc at the interface.Most everything seems to be working quite well -- the plugin loads on demand and the code executes as I expect it to.
However, when I need to make a change to the plugin and recompile it with cargo, reloading the dylib from the host does not seem to see the new changes. If I exit the host, relaunch the host, and load the plugin once more on demand, it picks up the new changes.
My first attempt at a solution was to manually call
close
on the libloading::Library after I am done using the plugin, before reloading it. That didn't seem to work, though it is possible I made a mistake.I have not had a chance to inspect the situation more deeply, but am also not quite sure yet where to start...
I think getting some sleep might help! I am off to take care of that now! 😁😴 Thanks in advance for any help!
The text was updated successfully, but these errors were encountered: