I develop both the process and the '.so' dynamic library.
I have the following scenario:
- Using
dlopen()my process is loading my '.so' library, - I load symbols and use the library,
- After some time I stop using the the library and unload it using
dlclose(), - Now I edit my library-code, fixing bugs, and then rebuild it,
- At later point, while process is still active, I want to reload the new version of my library.
I calldlopen()once more, hoping the new image will be loaded.
The problem is that even though last dlclose() did succeed (returned 0), and even though now I successfully reload my library and symbols, I can see that the library was not really reloaded, and the old code is running.
I understand that dlclose() keeps the library in the process memory for some time and does not necessarily unloads it immediately.
Can I force my library to be unloaded, or be replaced with the new dlopen()?