How to work (portably) with C++ class hierarchies & dynamic linked libraries

隐身守侯 提交于 2019-12-04 07:30:13

I actually found the answer to my question due to the fact that I needed to formulate it completely, and I did a better google search :) It seems to be

__attribute__((dllimport)) // import
__attribute__((dllexport)) // export

Will try that, I thought I'd leave the question here too, in case someone else stumbles on this problem (and as a warning to people that same header file included in a "main binary" & DLL will normaly lead to different actual implementation, depending on the compiler options - unless you put the proper dllimport/export attributes on the class).

That would only work if RTTI is enabled. You, probably, get that automatically enabled in MSVC++, but gcc requires specific link switches. Look in GCC FAQ for details.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!