Exceptions on Linux from a shared object (.so)

孤人 提交于 2019-12-05 17:36:22

Assuming your using gcc -

Append -Wl,-E when you build the executable calling dlload(). This exports all type info symbols from the executable, which should allow the RTTI (when catching the exception) to work properly.

VC++ uses string compares to match typeinfo, results in slower dynamic_cast<> etc but smaller binaries. g++ uses pointer compares.

I encountered the same problem when attempting to use pure virtual interfaces classes implemented in a run-time loaded .so.

There are a few articles relating to the subject floating around on the net as well.

hope that helps, Hayman.

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