![]() |
![]() |
![]() |
![]() |
You can embed GPlugin into any language that has GObject-Introspection support, but in this example we're going to look at embedding GPlugin into a C based project.
Using GPlugin is pretty simple and I'd like to think straight forward since that's the way I designed it.
During the start up of your application you need to add the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
/* Initialize the GPlugin library */ gplugin_init(); /* Tell GPlugin to look for plugins in its default paths */ gplugin_manager_add_default_paths(); /* Optionally tell GPlugin to look for plugins in application specific * paths. */ gplugin_manager_add_app_paths(PREFIX, "application"); /* Once you're ready to find/load plugins call g_plugin_manager_refresh. */ gplugin_manager_refresh(); |
When your application is shutting down you need to uninitialize GPlugin by calling
1 |
gplugin_uninit(); |