apolukhin / Boost.DLL

Library for comfortable work with DLL and DSO
https://boost.org/libs/dll
109 stars 69 forks source link

use extern "C++" instead of extern "C" will crash #50

Closed qicosmos closed 4 years ago

qicosmos commented 4 years ago

I want to export a std::string foo(), and use extern "C++" to avoid a warning, however when i get the function, it crashed. So i want to know if boos.dll support extern "C++" or not? How can i export such kind of c++ function with boost.dll?

apolukhin commented 4 years ago

extern "C++" is supported, but with it your function will be mangled and you have to provide a mangled name during import. Find the correct mangled name via inspecting the symbols of your binary via platform specific tools.

You could also use the mangled import but that feature is experimental and may crush on complex cases