Snap! Websites
An Open Source CMS System in C++
Under Linux, we can use dlopen() to load a .so file. We will be using that function to load our plugins.
The function takes care of executing the C++ initialization as required (and corresponding destructions on dlclose() calls.)
This means we can create a plugin simply by creating a listener that will receive signals from the other plugins and Snap! core. The listener is created as a global variable which the dlopen() function automatically initializes (and if necessary, the dlclose() will turn it off.)
The dlopen() gives you a choice in loading everything in LAZY mode and making all the symbols GLOBAL. We need both flags!
Note that imposes a certain number of constrains and it is important to understand how the system manages the initialization process to avoid problems such as "function not found."
Snap! Websites
An Open Source CMS System in C++