plugin-loader: Add facility to register plugin constructors
Enabled when building monolithically and statically. This should allow us to work around the -whole-archive issue with libtool. If the libraries register the plugin constructors they provide they reference the constructors and will therefore prevent the linker from removing these seemingly unused symbols from the final executable. For use cases where dlsym() can be used, e.g. because the static libraries are manually linked with -whole-archive (Linux) or -force-load (Apple), this can be disabled by passing ss_cv_static_plugin_constructors=no to the configure script.
This commit is contained in:
@@ -168,4 +168,14 @@ plugin_loader_t *plugin_loader_create();
|
||||
*/
|
||||
void plugin_loader_add_plugindirs(char *basedir, char *plugins);
|
||||
|
||||
#ifdef STATIC_PLUGIN_CONSTRUCTORS
|
||||
/**
|
||||
* Register a plugin constructor in case of static builds.
|
||||
*
|
||||
* @param name name of the plugin
|
||||
* @param constructor constructor to register (set to NULL to unregister)
|
||||
*/
|
||||
void plugin_constructor_register(char *name, void *constructor);
|
||||
#endif
|
||||
|
||||
#endif /** PLUGIN_LOADER_H_ @}*/
|
||||
|
||||
Reference in New Issue
Block a user