An example showing how to load dynamic libraries at runtime using C.
This allows dynamic code execution, useful when adding module/plugin support to an app.
Build using CMake >= 3.5 with
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release ..
make
This builds a main executable dynlib
as well as two example libraries: foo
and bar
.
The main executable expects its first argument to be the library to load:
./dynlib ./libfoo.so
or
./dynlib ./libbar.so
NOTE: This is Linux; on other platforms the name of the libraries may vary.
This software is distributed under the terms of the GNU General Public License v3.