This is an educational task aimed at understanding how to link
with static and dynamic libraries and use dlopen(3)
at
runtime.
libfoo
— static library
libbar
— dynamic library, linked
libbaz
— dynamic library, loaded with dlopen
foobarbaz
— executable that loads the 3 libs
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX=../prefix
$ make install
$ cd ../prefix/bin
$ LD_LIBRARY_PATH=. ./foobarbaz # Prints 'FooBarBaz'
$ ldd ./foobarbaz # Does not show libbaz.so
Ilya Bizyaev, 2019 ([email protected])
Available in public domain.