I created a shared library using BOOST using the following to specify the factory method:
BOOST_DLL_ALIAS_SECTIONED(
MyPlugin::create, // Plugin's factory method being exported
create_plugin, // Alias for factory method.
MySectionName) // The section name that all factory methods are grouped in.
The create() method returns a shared pointer to the MyPlugin object.
I then load the shared library and try to fetch the particular section using:
boost::dll::library_info inf(shared_library_path);
And then locate the above section with:
std::vector<std::string> sections = inf.sections();
if (std::find(sections.begin(), sections.end(), "MySectionName") == sections.end()) {
// Do something
} else
{
// Error out
}
If the shared library was not stripped, the above allows me to find
MySectionName within its contents and perform actions within the bracket.
If I however strip the shared library (default: strip library_name.so), the
above library info no longer lists the defined section and I hit the error out
condition.
I can protect the particular factory method during strip by specifying "-Kcreate" flag, but while that works with this simple shared library, more complex libraries end up with more missing symbols and it almost feels counterproductive to keep expanding the "-K" flag.
Is here an easier way of using BOOST for plugin creation using the above method and still allow stripping out debug information without having to expand with "-K" flag?
Thank you
