When developing a C/C++ (=2?) plugin based framework with shared objects/dynamic libraries that need to support live swapping what examples would be helpful to look at for implementation details?
Thanks.
Note: live swapping is the key point here, no need to restart the system is a requirement
If you are on POSIX, dlopen()
, dlsym()
and dlclose()
are all you need.
See man dlsym
for details and examples.
There is a good article about loading dynamic libraries, and plugin infrastructure is an example.
EDIT OP added Windows as requirement so this approach won't help since Windows isn't POSIX-compliant. However there are similar functions in WinAPI - see here.
You might want to try Boost.Extension but beware : despite its name, it is not one of boost libraries.
Here is a link to its documentation.
For C++ plugins you can check this article which detail how to achieve it with the previously mentionned posix calls.
Quoting the article :
Given that we can use these functions to access functions in a C library, how do we use them to access classes in a C++ library? There are several problems to overcome. One is that we must be able to locate the symbols we need in the library. This is trickier than it might seem because of the difference between the way symbols are stored in C and C++ files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With