diff --git a/include/gds-render/output-renderers/external-renderer-interfaces.h b/include/gds-render/output-renderers/external-renderer-interfaces.h index 64a651c..bef73c2 100644 --- a/include/gds-render/output-renderers/external-renderer-interfaces.h +++ b/include/gds-render/output-renderers/external-renderer-interfaces.h @@ -13,6 +13,11 @@ * @{ */ +/** + * @brief This define is used to export a function from a shared object + */ +#define EXPORT_FUNC __attribute__((visibility("default"))) + /** * @brief Function name expected to be found in external library for rendering. * @@ -46,14 +51,15 @@ * * The pure presence of this symbol name causes forking. The content of this variable is don't care. * @note Use this if you mess with the internal structures of gds-render - * */ #define EXTERNAL_LIBRARY_FORK_REQUEST exported_fork_request /** - * @brief Define for declaring the exported functions + * @brief Define for declaring the exported functions. + * + * This not only helps with the declaration but also makes the symbols visible, so they can be called form outside the library */ -#define FUNC_DECL(FUNC) FUNC +#define EXPORTED_FUNC_DECL(FUNC) EXPORT_FUNC FUNC /** * @brief Define for declaring exported variables diff --git a/plugins/plugin-example/CMakeLists.txt b/plugins/plugin-example/CMakeLists.txt index 3b24aa4..949119a 100644 --- a/plugins/plugin-example/CMakeLists.txt +++ b/plugins/plugin-example/CMakeLists.txt @@ -9,3 +9,5 @@ link_libraries(version) add_library(${PROJECT_NAME} SHARED EXCLUDE_FROM_ALL ${SOURCES}) add_dependencies(${PROJECT_NAME} version) +set_target_properties(${PROJECT_NAME} PROPERTIES C_VISIBILITY_PRESET hidden) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) diff --git a/plugins/plugin-example/src/plugin-main.c b/plugins/plugin-example/src/plugin-main.c index d6defc5..ce991e0 100644 --- a/plugins/plugin-example/src/plugin-main.c +++ b/plugins/plugin-example/src/plugin-main.c @@ -30,7 +30,7 @@ #include #include -int FUNC_DECL(EXTERNAL_LIBRARY_RENDER_FUNCTION)(struct gds_cell *toplevel, GList *layer_info_list, const char *output_file_name, double scale) +int EXPORTED_FUNC_DECL(EXTERNAL_LIBRARY_RENDER_FUNCTION)(struct gds_cell *toplevel, GList *layer_info_list, const char *output_file_name, double scale) { if (!toplevel) return -1000; @@ -39,7 +39,7 @@ int FUNC_DECL(EXTERNAL_LIBRARY_RENDER_FUNCTION)(struct gds_cell *toplevel, GList return 0; } -int FUNC_DECL(EXTERNAL_LIBRARY_INIT_FUNCTION)(const char *params, const char *version) +int EXPORTED_FUNC_DECL(EXTERNAL_LIBRARY_INIT_FUNCTION)(const char *params, const char *version) { printf("Init with params: %s\ngds-render version: %s\n", params, version); return 0;