Tatooine

Loading of a C++ class from a shared library (Modern C++)

Loading of a C++ class from a shared library (Modern C++) To go to the Github repository, click here. There is already a lot of stuff on internet, related to dynamic loading of classes from a shared library. However I couldn’t find a simple example and explanation on how to do it with the following conditions : Modern C++ (from c++11): Use of smart pointers to store the classes retrieved from the libraries Cross-platform: Works on UNIX (tested on Linux & MacOS) and Windows. Generic enough to be used by a wide range of programs. Introduction One of the best ways to make a C++ program accept plugins is to use dynamic loading of a class from a library. According to Wikipedia, dynamic loading is the process that allows to retrieve functions and variables from a library. It’s very powerful, for multiple reasons: ...

February 26, 2018 · 10 min · Theo Penavaire