Closed jcelerier closed 6 years ago
This functionality already exists and you just have to use boost::dll::library_info
for getting a list of plugins from the executable https://www.boost.org/doc/libs/1_67_0/doc/html/boost_dll/tutorial.html#boost_dll.tutorial.querying_libraries_for_symbols
Here's an example https://github.com/boostorg/dll/blob/d2be74ebbbb96800f777a62258fc2270c0e011a0/test/library_info_test.cpp#L54-L62 (boostdll
is the default section name for all the functions registered using Boost.DLL macro (BOOST_DLL_ALIAS and others))
Note that you could replace argv[0] with a call to boost::dll::program_location()
.
This section : https://www.boost.org/doc/libs/1_67_0/doc/html/boost_dll/tutorial.html#boost_dll.tutorial.linking_plugin_into_the_executable
proposes a method that works fine, given a single plug-in with a symbol of known name. If there are multiple plug-ins linked into the executable, however, this does not really scale : the executable has to know the name of all plug-ins linked into it statically : the plug-in symbol, for instance
create_plugin
has to be different for each plug-in.The solution in Qt is to have a global registry of such plug-ins: http://doc.qt.io/qt-5/qpluginloader.html#staticInstances ; is there something similar in boost.dll ?