Manu343726 / siplasplas

A library for C++ reflection and introspection
https://manu343726.github.io/siplasplas
MIT License
195 stars 27 forks source link

plugin example segfault #48

Closed Manu343726 closed 7 years ago

Manu343726 commented 7 years ago

the plugin reflection example (Loading dynamically reflected types from dynamic libraries at runtime) segfaults at exit. It seems that the dynamic reflection runtime has references to the dynamic library types (cpp::dynamic_reflection::Type::TypeBehavior instances instanced by the dynamic library when registering its types) instanced by the library side. After unloading the library, that types metadata is freed by the executable side.

Solution: Pass a callback to SIPLASPLAS_REFLECTION_LOAD() instead of a reference to the reflection runtime, to ensure registration is run on the executable side.