-
Notifications
You must be signed in to change notification settings - Fork 23
Dynamic libraries handling
Refureku supports the reflection of entities located in dynamic libraries. In any executable, the Refureku Database will ultimately contain the metadata of the executable reflected entities as well as the metadata of all currently loaded dynamic libraries reflected entities.
If you ever want to unload a dynamic library at runtime, you must ensure that all dynamic libraries that depend on the unloaded library are unloaded first. For example:
//libA.so (.lib, .dylib)
class CLASS() A_API A {};
//libB.so (.lib, .dylib)
class CLASS() B_API B : public A
{
FIELD()
A* ptrToA = nullptr;
};
In such a situation, the reflection metadata contained in the B archetype directly reference A archetype metadata (which is located in a different dynamic library), so unloading libA first will break all libB references to A metadata resulting in undefined behaviour.
For that reason, it is required to unload dependant libraries first: in this case, unload libB first, then libA.