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

后端 未结 2 1072
礼貌的吻别
礼貌的吻别 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.

提交回复
热议问题