Boost logo

Boost :

Subject: Re: [boost] Checking interest in DynamicLoad/DLL/DSO/Plugin library
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2014-08-16 14:10:50


2014-08-16 16:29 GMT+04:00 Hartmut Kaiser <hartmut.kaiser_at_[hidden]>:
<...>

> > > - the ability to extract a list of plugin object names from a given
> > shared
> > > library ( I assume that your library allows to have several plugin
> types
> > in
> > > the same shared library)
> > >
> >
> > Could be queried using the bool res =
> > lib.search_symbol("some_name_of_the_plugin")
>
> That's not what I meant. You're suggesting to find a known symbol. I was
> suggesting to find the list of names for the existing (unknown) plugins.
>

This can be currently achieved using the following:

// in plugin/dll
namespace foo {
  std::vector<std::string> list_plugins();
}

BOOST_PLUGIN_ALIAS(foo::list_plugins, list_plugins)

// in code that uses plugin
shared_library lib(path_to_lib);
auto plugins = lib.get<std::vector<std::string>()>("list_plugins");
for (auto& s: plugins) { ... lib.get</**/>(s) ... }

Hmmm... This does not look user-friendly. I could do some experiments with
putting the aliased names into a separate section of the binary and
iterating over values in that section.
Will iteration over BOOST_PLUGIN_ALIASed symbols suit you? Iterating over
all the exported symbols does not look useful: there;ll be a lot of mangled
names and sompiler-specific trash.

-- 
Best regards,
Antony Polukhin

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk