Mercurial > hg > freeDiameter
changeset 1493:a89913941dcf
extensions: hide symbols by default
Hide extension.fdx symbols by default, by setting the
target property <LANG>C_VISIBILITY_PRESET hidden.
This requires cmake 2.8+
Explicitly export fd_ext_init() and fd_ext_fini(),
using gcc or clang's __attribute__((visibility()))
author | Luke Mewburn <luke@mewburn.net> |
---|---|
date | Mon, 30 Mar 2020 15:31:48 +1100 |
parents | fadf8947c0fb |
children | ae76ea63ee12 |
files | extensions/CMakeLists.txt include/freeDiameter/extension.h |
diffstat | 2 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/extensions/CMakeLists.txt Mon Mar 30 12:38:31 2020 +1100 +++ b/extensions/CMakeLists.txt Mon Mar 30 15:31:48 2020 +1100 @@ -10,6 +10,8 @@ ADD_LIBRARY(${EXTNAME} MODULE ${ARGN}) SET_TARGET_PROPERTIES(${EXTNAME} PROPERTIES PREFIX "" ) SET_TARGET_PROPERTIES(${EXTNAME} PROPERTIES SUFFIX ".fdx" ) + SET_TARGET_PROPERTIES(${EXTNAME} PROPERTIES C_VISIBILITY_PRESET hidden ) + SET_TARGET_PROPERTIES(${EXTNAME} PROPERTIES CXX_VISIBILITY_PRESET hidden ) ENDMACRO(FD_ADD_EXTENSION) # Use the macro FD_EXTENSION_SUBDIR(extmacroname subdir descr default) to
--- a/include/freeDiameter/extension.h Mon Mar 30 12:38:31 2020 +1100 +++ b/include/freeDiameter/extension.h Mon Mar 30 15:31:48 2020 +1100 @@ -48,6 +48,8 @@ #define EXTENSION_ENTRY(_name, _function, _depends...) \ const char *fd_ext_depends[] = { _name , ## _depends , NULL }; \ static int extension_loaded = 0; \ + \ +__attribute__((visibility("default"))) \ int fd_ext_init(int major, int minor, char * conffile) { \ if ((major != FD_PROJECT_VERSION_MAJOR) \ || (minor != FD_PROJECT_VERSION_MINOR)) { \ @@ -63,7 +65,11 @@ } \ extension_loaded++; \ return (_function)(conffile); \ -} +} + +/* Optional exit point (finish function) of the extension */ +__attribute__((visibility("default"))) +void fd_ext_fini(void); #ifdef __cplusplus }