[DLL] BOOST_DLL_ALIAS not working on MinGW-w64

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[DLL] BOOST_DLL_ALIAS not working on MinGW-w64

Boost - Users mailing list
Hello,

I'm using boost 1.68 on MinGW-w64 (Windows 10). I'm trying a simple
plugin that works fine under Linux and FreeBSD

However, on Windows boost::dll::import_alias triggers an exception:

terminate called after throwing an instance of
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error>
 >'
   what():  boost::dll::shared_library::get() failed: The specified
procedure could not be found

This is the plugin (plugin.cpp)

     #include <iostream>

     #include <boost/dll.hpp>

     namespace custom {

     void my_function()
     {
             puts("CALLED");
     }

     } // !custom

     BOOST_DLL_ALIAS(custom::my_function, my_function)


I compile using:

g++ -std=c++17 -shared -o plugin.dll plugin.cpp -lboost_system-mt

And the simple main.cpp file:

     #include <boost/dll.hpp>

     int main()
     {
             using my_function = void ();

             auto f =
boost::dll::import_alias<my_function>("./plugin.dll", "my_function");
     }

What's strange, nm does not report any kind of unmangled symbols related
to "my_function":

     $ nm plugin.dll | grep my_function
     0000000067e81422 t _GLOBAL__sub_I__ZN6custom11my_functionEv
     0000000067e813b0 T _ZN6custom11my_functionEv

It should contains something starting with boostdll_ isn't it? What's
happening there?

Do I miss something?

--
David
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users