2014-10-07 3:51 GMT+04:00 Niall Douglas <s_sourceforge@nedprod.com>:
<...> Prints:
18$$magic$$_fprinterILZN21$$magic$$_adl_barrier18export_me_functionE7v ariantIis5void_S2_S2_ES3_EE 18$$magic$$_vprinterILZN21$$magic$$_adl_barrier18export_me_variableEEE
Exported:
__ZN3foo11adl_barrier18export_me_functionE7variantIis5void_S2_S2_ES3_ __ZN3foo11adl_barrier18export_me_variableE
... which looks bang on. Simply replace the 8fprinter with 3foo and remove the $$magic$$_.
Still looks like something error-prone. Actually, user could always get the list of mangled symbols using the boost::dll::library_info class methods on a compiled binary. So instead of using mangling voodoo macro and explicitly declaring exports in import module, user can find all the export_me_* mangled names and import them using any of the interfaces. Something close can be found in this example: http://apolukhin.github.io/Boost.DLL/boost_dll/tutorial.html#boost_dll.tutor... ... some dream of a nicest solution: Add attribute [[abi_name "new_abi_name"]], remove all the *_alias methods and member function, remove _ALIAS macro. Now user is free to do following things: // in plugin: namespace foo { namespace adl_barrier { [[abi_name "export_me_function_1"]] BOOST_SYMBOL_EXPORT boost::variant<int, short> export_me_function( boost::variant<int, short>, boost::variant<int, short>) { return 0; } [[abi_name "export_me_variable_1"]] BOOST_SYMBOL_EXPORT boost::variant<int, short> export_me_variable; } // namespace adl_barrier } // in importer: dll::shared_library lib(lib_path); typedef boost::variant<int, short> vis_t; auto f = lib.get<vis_t(vis_t, vis_t)>("export_me_function_1"); auto v = lib.get<vis_t>("export_me_variable_1"); Code from above looks nice, but requires abi_name attribute that was not even proposed to C++ standardization and until now existed only in my head. -- Best regards, Antony Polukhin