Hi,
The problem is with the tutorial, not the library itself.
Your factory method in tutorial returns boost::shared_ptr.
However, you import it via alias, as function returning boost::shared_ptr, which is quite confusing.
I was wondering HOW this could even work in general, with all the low level stuff going on, but I checked that it doesn't really work:
program crashes (in gcc and clang) as soon as address of my_plugin_api subobject differs from that of my_plugin_aggregator
object. To see the problem, simply change my_plugin_aggregator to something like
class my_plugin_aggregator : public S, public my_plugin_api {/*.../*};
with
struct S {
float f = 13.0;
virtual ~S() = default;
};
By constrast, if your factory method returns boost::shared_ptr (as it should I guess), everythng works just fine with new version of my_plugin_aggregator.
Hi, The problem is with the tutorial, not the library itself. Your factory method in tutorial returns boost::shared_ptr.
However, you import it via alias, as function returning boost::shared_ptr, which is quite confusing.
I was wondering HOW this could even work in general, with all the low level stuff going on, but I checked that it doesn't really work:
program crashes (in gcc and clang) as soon as address of my_plugin_api subobject differs from that of my_plugin_aggregator
object. To see the problem, simply change my_plugin_aggregator to something like
class my_plugin_aggregator : public S, public my_plugin_api {/*.../*};
with struct S { float f = 13.0; virtual ~S() = default; };By constrast, if your factory method returns boost::shared_ptr (as it should I guess), everythng works just fine with new version of my_plugin_aggregator.
`