03-29-2026 07:37 PM
I have a hopefully simple question about loading plugin classes from PPL during runtime. Say I have class A (common plugin interface), class B that inherits from A, and class C that inherits from B. A, B, and C are built into their own separate PPLs and an exe uses A for the plugin interface. If I were to load class C from disk using factory pattern during runtime, would I as well need to load B or would loading C automatically look for B in the same plugin directory and load it? Similarly, if I needed to update B during runtime with a new PPL, would I simply replace B and C PPLs in the plugin directory and load C again from the exe?
Thank you!
03-30-2026 12:22 PM - edited 03-30-2026 12:23 PM
All your classes get new names and identities once they're in the PPLs, you'll have to specify how they relate to each other to get an answer.
If class C inherits from B and you build C into a PPL, "c.lvlibp:C" will inherit from c.lvlibp:A and c.lvlibp:B and it will not be castable as a child of, say, A.lvlibp:A.
If you first build A and relink B and C to inherit from A.lvlibp:A, and build both to their own PPLs then B.lvlibp:B and C.lvlibp:C will be castable as a child of A.lvlibp:A but C.lvlibp:C will not be castable as a child of B.lvlibp:B and will instead include C.lvlibp:B. In this situation C.lvlibp includes its own copy of B.
If you want to only have one copy of B, you'd have B inherit from A.lvlibp:A and C inherit from B.lvlibp:B. C.lvlibp would then expect B.lvlibp:B to exist on disk at the same relative path as when C.lvlibp was built.
Unloading classes at runtime (so they can be modified) is its own animal and even less intuitive. Here's a blog post about it.