dynamic_cast an interface from a shared library which was loaded by lt_dlopen(libtool) doesn't work

后端 未结 2 1043
礼貌的吻别
礼貌的吻别 2021-01-22 01:19

This is about plugin features in my program. I need a C++ class(and object) in a plugin could be used by main module through an interface. The interface inheritance like this:

相关标签:
2条回答
  • 2021-01-22 01:49

    You're problem may be the private inheritance:

    _rwd_autocomplete_plugin_base_t : _rwd_plugin_base_t

    Also I think because you have virtual functions your types are already polymorphic, but wouldn't hurt to add virtual destructors.

    Edit: Sorry just realized you're using struct there so the default inheritance is public. But probably best to be explicit, especially since you're seeing differences between compilers.

    0 讨论(0)
  • 2021-01-22 01:56

    you might try building with -Wl,--export-dynamic linker argument. I recall needing this argument when encountering similar behavior.

    0 讨论(0)
提交回复
热议问题