c++ - Exporting static lib symbols from DLL -


i'm using facade dll static lib. dll provides small interface , resource management shared across multiple dlls. dll-header expose stuff static library:

class dll_export mydllclass { public:    /// ...    onestaticlibclass * ptr; }; 

the problem is: if should works i've link staticlib dll , application using dll. didn't manage export parts of staticlib correctly. tried in export headers:

class dll_export onestaticlibclass; 

but doesn't work... still get:

undefined reference onestaticlibclass::~onestaticlibclass(void) undefined reference onestaticlibclass::operator<<(char const *) 

andy ideas how can export parts of static library dll?

thank you!

you need create .def file , pass linker. dllexport not necessary in case.

the reason way symbols resolved when using static library. when create dll, symbols needed dll searched, , object files containing these symbols copied dll. if dll code not reference destructor, not included.

a .def file tell linker functions exported. exported functions searched , pulled static library.

one downside of process need use mangled c++ names in .def file. mangled names can obtained dumpbin utility.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -