billyquith / ponder

C++ reflection library with Lua binding, and JSON and XML serialisation.
http://billyquith.github.io/ponder/
Other
648 stars 95 forks source link

Registering new types dynamically (via Plugins) #89

Open hydexon opened 6 years ago

hydexon commented 6 years ago

There's an way or what to modify from Ponder able to register new types via Plugins or dynamic/static plugins? where the core application doesn't have access to the headers of the new types?

billyquith commented 6 years ago

able to register new types via Plugins or dynamic/static plugins? where the core application doesn't have access to the headers of the new types?

The plugins containing the metadata must have seen the headers at some point or they couldn't generate the metadata. Once the metadata is compiled into the plugin, yes, it can be loaded without needing the headers.

You can also unregister the types when the plugin is unloaded. See #21.

hydexon commented 6 years ago

I don't understand very well, both the host application and the plugin itself links to Ponder, the plugin new types has their respective headers to generate the needed metadata required by Ponder, but the host application doesn't know the new exported types in the C++ side, but should be known by the Host's Ponder API side when i load the DLL explicitly to the memory (via dlopen or LoadLibrary APIs).

billyquith commented 6 years ago

Needs docs and example.

hydexon commented 6 years ago

Just a little remark, make your users implement their own library loading strategies instead of Ponder do it so.

Some projects have their own way to load their libraries, and maybe an already integrated plugin framework which is used for unrelated or specialized classes.

billyquith commented 6 years ago

Interesting idea.