This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/bundle_linker_script
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 5ab7fcf6c731fdec953e161c89a0bbc4c59b0276
Author: Pepijn Noltes <[email protected]>
AuthorDate: Sun Apr 30 19:40:06 2023 +0200

    Add celix_bundle_hide_symbols cmake function
---
 .../log_service_v2/src/log_service_activator.c     | 10 +--
 .../topology_manager/src/activator.c               | 12 ++--
 bundles/shell/shell/src/c_shell_activator.c        | 12 ++--
 cmake/celix_project/CelixProject.cmake             |  6 +-
 cmake/cmake_celix/BundlePackaging.cmake            | 72 ++++++++++++++++++++--
 .../make_only_activator_symbols_global.list        | 22 ++-----
 .../make_only_activator_symbols_global.map         | 18 ++++++
 documents/bundles.md                               | 53 ++++++++++++++--
 documents/cmake_commands/README.md                 | 23 +++++++
 .../readme_c_examples/CMakeLists.txt               |  7 +++
 .../readme_c_examples/src/my_bundle_activator.c    | 17 +++--
 libs/framework/include/celix/BundleActivator.h     |  8 +--
 12 files changed, 207 insertions(+), 53 deletions(-)

diff --git a/bundles/logging/log_service_v2/src/log_service_activator.c 
b/bundles/logging/log_service_v2/src/log_service_activator.c
index 65702183..a1d1ccf2 100644
--- a/bundles/logging/log_service_v2/src/log_service_activator.c
+++ b/bundles/logging/log_service_v2/src/log_service_activator.c
@@ -28,7 +28,7 @@
 #include <string.h>
 #include "celix_constants.h"
 
-#include "bundle_activator.h"
+#include "celix_bundle_activator.h"
 #include "log_service_impl.h"
 #include "service_factory.h"
 #include "log_factory.h"
@@ -59,7 +59,7 @@ struct logActivator {
 static celix_status_t bundleActivator_getMaxSize(struct logActivator 
*activator, int *max_size);
 static celix_status_t bundleActivator_getStoreDebug(struct logActivator 
*activator, bool *store_debug);
 
-celix_status_t bundleActivator_create(celix_bundle_context_t *context, void 
**userData) {
+celix_status_t celix_bundleActivator_create(celix_bundle_context_t *context, 
void **userData) {
     celix_status_t status = CELIX_SUCCESS;
        struct logActivator * activator = NULL;
 
@@ -83,7 +83,7 @@ celix_status_t bundleActivator_create(celix_bundle_context_t 
*context, void **us
     return status;
 }
 
-celix_status_t bundleActivator_start(void * userData, celix_bundle_context_t 
*context) {
+celix_status_t celix_bundleActivator_start(void * userData, 
celix_bundle_context_t *context) {
     struct logActivator * activator = (struct logActivator *) userData;
     celix_status_t status = CELIX_SUCCESS;
 
@@ -128,7 +128,7 @@ celix_status_t bundleActivator_start(void * userData, 
celix_bundle_context_t *co
     return status;
 }
 
-celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t 
*context) {
+celix_status_t celix_bundleActivator_stop(void * userData, 
celix_bundle_context_t *context) {
        struct logActivator * activator = (struct logActivator *) userData;
 
        serviceRegistration_unregister(activator->logReaderServiceReg);
@@ -152,7 +152,7 @@ celix_status_t bundleActivator_stop(void * userData, 
celix_bundle_context_t *con
     return CELIX_SUCCESS;
 }
 
-celix_status_t bundleActivator_destroy(void * userData, celix_bundle_context_t 
*context) {
+celix_status_t celix_bundleActivator_destroy(void * userData, 
celix_bundle_context_t *context) {
        struct logActivator * activator = (struct logActivator *) userData;
 
        free(activator);
diff --git a/bundles/remote_services/topology_manager/src/activator.c 
b/bundles/remote_services/topology_manager/src/activator.c
index 26068e5c..e4a6eeaf 100644
--- a/bundles/remote_services/topology_manager/src/activator.c
+++ b/bundles/remote_services/topology_manager/src/activator.c
@@ -29,7 +29,7 @@
 #include <string.h>
 
 #include "celix_constants.h"
-#include "bundle_activator.h"
+#include "celix_bundle_activator.h"
 #include "service_tracker.h"
 #include "service_registration.h"
 
@@ -68,7 +68,7 @@ static celix_status_t bundleActivator_createEPLTracker(struct 
activator *activat
 static celix_status_t bundleActivator_createRSATracker(struct activator 
*activator, service_tracker_t **tracker);
 static celix_status_t bundleActivator_createExportedServicesTracker(struct 
activator *activator, service_tracker_t **tracker);
 
-celix_status_t bundleActivator_create(celix_bundle_context_t *context, void 
**userData) {
+celix_status_t celix_bundleActivator_create(celix_bundle_context_t *context, 
void **userData) {
        celix_status_t status = CELIX_SUCCESS;
        struct activator *activator = NULL;
        void *scope;
@@ -118,7 +118,7 @@ celix_status_t 
bundleActivator_create(celix_bundle_context_t *context, void **us
        }
 
        if(status != CELIX_SUCCESS){
-               bundleActivator_destroy(activator,context);
+        celix_bundleActivator_destroy(activator,context);
        }
 
        return status;
@@ -155,7 +155,7 @@ static celix_status_t 
bundleActivator_createExportedServicesTracker(struct activ
     return status;
 }
 
-celix_status_t bundleActivator_start(void * userData, celix_bundle_context_t 
*context) {
+celix_status_t celix_bundleActivator_start(void * userData, 
celix_bundle_context_t *context) {
        celix_status_t status;
        struct activator *activator = userData;
 
@@ -217,7 +217,7 @@ celix_status_t bundleActivator_start(void * userData, 
celix_bundle_context_t *co
        return status;
 }
 
-celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t 
*context) {
+celix_status_t celix_bundleActivator_stop(void * userData, 
celix_bundle_context_t *context) {
        celix_status_t status = CELIX_SUCCESS;
        struct activator *activator = userData;
 
@@ -247,7 +247,7 @@ celix_status_t bundleActivator_stop(void * userData, 
celix_bundle_context_t *con
        return status;
 }
 
-celix_status_t bundleActivator_destroy(void * userData, celix_bundle_context_t 
*context) {
+celix_status_t celix_bundleActivator_destroy(void * userData, 
celix_bundle_context_t *context) {
        celix_status_t status = CELIX_SUCCESS;
 
        struct activator *activator = userData;
diff --git a/bundles/shell/shell/src/c_shell_activator.c 
b/bundles/shell/shell/src/c_shell_activator.c
index 2376409f..17acf4fd 100644
--- a/bundles/shell/shell/src/c_shell_activator.c
+++ b/bundles/shell/shell/src/c_shell_activator.c
@@ -22,7 +22,7 @@
 #include <string.h>
 
 #include "shell_private.h"
-#include "bundle_activator.h"
+#include "celix_bundle_activator.h"
 #include "std_commands.h"
 #include "service_tracker.h"
 #include "celix_constants.h"
@@ -42,7 +42,7 @@ struct shell_bundle_activator {
 
 typedef struct shell_bundle_activator shell_bundle_activator_t;
 
-celix_status_t bundleActivator_create(celix_bundle_context_t* ctx, void 
**_pptr) {
+celix_status_t celix_bundleActivator_create(celix_bundle_context_t* ctx, void 
**_pptr) {
        celix_status_t status = CELIX_SUCCESS;
 
     shell_bundle_activator_t* activator = NULL;
@@ -68,13 +68,13 @@ celix_status_t 
bundleActivator_create(celix_bundle_context_t* ctx, void **_pptr)
 
 
     if (status != CELIX_SUCCESS) {
-        bundleActivator_destroy(activator, ctx);
+        celix_bundleActivator_destroy(activator, ctx);
     }
 
        return status;
 }
 
-celix_status_t bundleActivator_start(void *activatorData, 
celix_bundle_context_t* ctx) {
+celix_status_t celix_bundleActivator_start(void *activatorData, 
celix_bundle_context_t* ctx) {
        celix_status_t status = CELIX_SUCCESS;
 
     shell_bundle_activator_t* activator  = (shell_bundle_activator_t*) 
activatorData;
@@ -128,7 +128,7 @@ celix_status_t bundleActivator_start(void *activatorData, 
celix_bundle_context_t
        return status;
 }
 
-celix_status_t bundleActivator_stop(void *activatorData, 
celix_bundle_context_t* ctx) {
+celix_status_t celix_bundleActivator_stop(void *activatorData, 
celix_bundle_context_t* ctx) {
     celix_status_t status = CELIX_SUCCESS;
 
     shell_bundle_activator_t* activator = activatorData;
@@ -146,7 +146,7 @@ celix_status_t bundleActivator_stop(void *activatorData, 
celix_bundle_context_t*
     return status;
 }
 
-celix_status_t bundleActivator_destroy(void *activatorData, 
celix_bundle_context_t* __attribute__((__unused__)) ctx) {
+celix_status_t celix_bundleActivator_destroy(void *activatorData, 
celix_bundle_context_t* __attribute__((__unused__)) ctx) {
     celix_status_t status = CELIX_SUCCESS;
     shell_bundle_activator_t* activator = activatorData;
 
diff --git a/cmake/celix_project/CelixProject.cmake 
b/cmake/celix_project/CelixProject.cmake
index 99aba815..cb521f9d 100644
--- a/cmake/celix_project/CelixProject.cmake
+++ b/cmake/celix_project/CelixProject.cmake
@@ -25,12 +25,14 @@ mark_as_advanced(CLEAR ENABLE_UNDEFINED_SANITIZER)
 mark_as_advanced(CLEAR ENABLE_THREAD_SANITIZER)
 
 if (ENABLE_ADDRESS_SANITIZER)
-    if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR 
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
+    if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
         set(CMAKE_C_FLAGS "-fsanitize=address -fno-omit-frame-pointer 
${CMAKE_C_FLAGS}")
         set(CMAKE_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer 
${CMAKE_CXX_FLAGS}")
-    else ()
+    elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
         set(CMAKE_C_FLAGS "-lasan -fsanitize=address -fno-omit-frame-pointer 
${CMAKE_C_FLAGS}")
         set(CMAKE_CXX_FLAGS "-lasan -fsanitize=address -fno-omit-frame-pointer 
${CMAKE_CXX_FLAGS}")
+    else ()
+        message(WARNING "Address sanitizer is not supported for 
${CMAKE_C_COMPILER_ID}")
     endif ()
 
     if (ENABLE_TESTING)
diff --git a/cmake/cmake_celix/BundlePackaging.cmake 
b/cmake/cmake_celix/BundlePackaging.cmake
index 90f312ce..5305c2c1 100644
--- a/cmake/cmake_celix/BundlePackaging.cmake
+++ b/cmake/cmake_celix/BundlePackaging.cmake
@@ -355,10 +355,6 @@ function(add_celix_bundle)
         set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES 
"BUNDLE_ACTIVATOR" "$<TARGET_SONAME_FILE_NAME:${BUNDLE_TARGET_NAME}>")
         set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES 
"BUILD_WITH_INSTALL_RPATH" true)
 
-        #TBD: The linker script ensures that only the activator symbols are 
exported, this can reduce the bundle size.
-        #     If this is done, there should also be an option to disable this 
behaviour.
-        target_link_libraries(${BUNDLE_TARGET_NAME} PRIVATE 
"-Wl,--version-script=${CELIX_CMAKE_DIRECTORY}/templates/make_only_activator_symbols_global.map")
-
         if(APPLE)
             set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES 
INSTALL_RPATH "@loader_path")
         else()
@@ -948,6 +944,74 @@ function(celix_get_bundle_file)
     endif ()
 endfunction ()
 
+#[[
+Configure the symbol visibility preset of the bundle library to hidden.
+
+This is done by setting the target properties C_VISIBILITY_PRESET to hidden, 
the CXX_VISIBILITY_PRESET to hidden and
+VISIBILITY_INLINES_HIDDEN to ON.
+
+```CMake
+celix_bundle_hide_symbols(<bundle_target> [RELEASE] [DEBUG] [RELWITHDEBINFO] 
[MINSIZEREL])
+```
+
+Optional arguments are:
+- RELEASE: hide symbols for the release build type
+- DEBUG: hide symbols for the debug build type
+- RELWITHDEBINFO: hide symbols for the relwithdebinfo build type
+- MINSIZEREL: hide symbols for the minsizerel build type
+
+If no optional arguments are provided, the symbols are hidden for all build 
types.
+
+Example:
+```CMake
+celix_bundle_hide_symbols(my_bundle RELEASE MINSIZEREL)
+```
+]]
+function(celix_bundle_hide_symbols)
+    list(GET ARGN 0 BUNDLE_TARGET)
+    list(REMOVE_AT ARGN 0)
+
+    set(OPTIONS RELEASE DEBUG RELWITHDEBINFO MINSIZEREL)
+    cmake_parse_arguments(HIDE_SYMBOLS "${OPTIONS}" "" "" ${ARGN})
+
+    set(BUILD_TYPE "")
+    if (CMAKE_BUILD_TYPE)
+        string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
+    endif ()
+
+    set(HIDE_SYMBOLS FALSE)
+    if (NOT HIDE_SYMBOLS_RELEASE AND NOT HIDE_SYMBOLS_DEBUG AND NOT 
HIDE_SYMBOLS_RELWITHDEBINFO AND NOT HIDE_SYMBOLS_MINSIZEREL)
+        set(HIDE_SYMBOLS TRUE)
+    elseif (HIDE_SYMBOLS_RELEASE AND BUILD_TYPE STREQUAL "RELEASE")
+        set(HIDE_SYMBOLS TRUE)
+    elseif (HIDE_SYMBOLS_DEBUG AND BUILD_TYPE STREQUAL "DEBUG")
+        set(HIDE_SYMBOLS TRUE)
+    elseif (HIDE_SYMBOLS_RELWITHDEBINFO AND BUILD_TYPE STREQUAL 
"RELWITHDEBINFO")
+        set(HIDE_SYMBOLS TRUE)
+    elseif (HIDE_SYMBOLS_MINSIZEREL AND BUILD_TYPE STREQUAL "MINSIZEREL")
+        set(HIDE_SYMBOLS TRUE)
+    endif ()
+
+    if (HIDE_SYMBOLS)
+        set_target_properties(${BUNDLE_TARGET}
+                PROPERTIES
+                C_VISIBILITY_PRESET hidden
+                CXX_VISIBILITY_PRESET hidden
+                VISIBILITY_INLINES_HIDDEN ON)
+#        if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
+#            target_link_options(${BUNDLE_TARGET} PRIVATE 
"LINKER:-exported_symbols_list,${CELIX_CMAKE_DIRECTORY}/templates/make_only_activator_symbols_global.list")
+#            set_target_properties(${BUNDLE_TARGET}
+#                    PROPERTIES
+#                    C_VISIBILITY_PRESET hidden
+#                    CXX_VISIBILITY_PRESET hidden)
+#        elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
+#            target_link_options(${BUNDLE_TARGET} PRIVATE 
"LINKER:--version-script=${CELIX_CMAKE_DIRECTORY}/templates/make_only_activator_symbols_global.map")
+#        else ()
+#            message(WARNING "Cannot hide symbols for bundle ${BUNDLE_TARGET}, 
unsupported linker")
+#        endif ()
+    endif ()
+endfunction()
+
 function(install_bundle)
     message(DEPRECATION "install_bundle is deprecated, use 
install_celix_bundle instead.")
     install_celix_bundle(${ARGN})
diff --git 
a/examples/celix-examples/readme_c_examples/src/my_bundle_activator.c 
b/cmake/cmake_celix/templates/make_only_activator_symbols_global.list
similarity index 52%
copy from examples/celix-examples/readme_c_examples/src/my_bundle_activator.c
copy to cmake/cmake_celix/templates/make_only_activator_symbols_global.list
index 54a4876c..348efcb9 100644
--- a/examples/celix-examples/readme_c_examples/src/my_bundle_activator.c
+++ b/cmake/cmake_celix/templates/make_only_activator_symbols_global.list
@@ -16,21 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
-#include <celix_bundle_activator.h>
-
-typedef struct my_bundle_activator_data {
-    /*the hello world bundle activator struct is empty*/
-} my_bundle_activator_data_t;
-
-static celix_status_t my_bundle_start(my_bundle_activator_data_t *data 
__attribute__((unused)), celix_bundle_context_t *ctx __attribute__((unused))) {
-    printf("Hello world from bundle with id %li\n", 
celix_bundleContext_getBundleId(ctx));
-    return CELIX_SUCCESS;
-}
-
-static celix_status_t my_bundle_stop(my_bundle_activator_data_t *data 
__attribute__((unused)), celix_bundle_context_t *ctx __attribute__((unused))) {
-    printf("Goodbye world\n");
-    return CELIX_SUCCESS;
-}
-
-CELIX_GEN_BUNDLE_ACTIVATOR(my_bundle_activator_data_t, my_bundle_start, 
my_bundle_stop)
\ No newline at end of file
+_celix_bundleActivator_create
+_celix_bundleActivator_destroy
+_celix_bundleActivator_start
+_celix_bundleActivator_stop
diff --git a/cmake/cmake_celix/templates/make_only_activator_symbols_global.map 
b/cmake/cmake_celix/templates/make_only_activator_symbols_global.map
index 43446eb8..7e3996d8 100644
--- a/cmake/cmake_celix/templates/make_only_activator_symbols_global.map
+++ b/cmake/cmake_celix/templates/make_only_activator_symbols_global.map
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 {
     global:
         celix_bundleActivator_create;
diff --git a/documents/bundles.md b/documents/bundles.md
index 6d14d48a..6ad1b36c 100644
--- a/documents/bundles.md
+++ b/documents/bundles.md
@@ -141,23 +141,32 @@ stop 0 #stop the Apache Celix framework
 ### C Example
 ```C
 //src/my_bundle_activator.c
+#include <stdio.h>
 #include <celix_bundle_activator.h>
 
 typedef struct my_bundle_activator_data {
     /*the hello world bundle activator struct is empty*/
 } my_bundle_activator_data_t;
 
-static celix_status_t my_bundle_start(my_bundle_activator_data_t *data, 
celix_bundle_context_t *ctx) {
+void myBundle_helloWorld(celix_bundle_context_t* ctx) {
     printf("Hello world from bundle with id %li\n", 
celix_bundleContext_getBundleId(ctx));
+}
+
+void myBundle_goodbyeWorld(celix_bundle_context_t* ctx) {
+    printf("Goodbye world from bundle with id %li\n", 
celix_bundleContext_getBundleId(ctx));
+}
+
+static celix_status_t myBundle_start(my_bundle_activator_data_t *data 
__attribute__((unused)), celix_bundle_context_t *ctx __attribute__((unused))) {
+    myBundle_helloWorld(ctx);
     return CELIX_SUCCESS;
 }
 
-static celix_status_t my_bundle_stop(my_bundle_activator_data_t *data, 
celix_bundle_context_t *ctx) {
-    printf("Goodbye world\n");
+static celix_status_t myBundle_stop(my_bundle_activator_data_t *data 
__attribute__((unused)), celix_bundle_context_t *ctx __attribute__((unused))) {
+    myBundle_goodbyeWorld(ctx);
     return CELIX_SUCCESS;
 }
 
-CELIX_GEN_BUNDLE_ACTIVATOR(my_bundle_activator_data_t, my_bundle_start, 
my_bundle_stop)
+CELIX_GEN_BUNDLE_ACTIVATOR(my_bundle_activator_data_t, myBundle_start, 
myBundle_stop)
 ```
 
 ```CMake
@@ -229,6 +238,42 @@ Apache Celix services. This means that unless 
functionality is provided by means
 bundle functionality is private to the bundle.
 In Apache Celix symbols are kept private by loading bundle libraries locally 
(`dlopen` with `RTLD_LOCAL`). 
 
+## Symbol visibility for bundles
+Bundles cannot directly access the symbols of another bundle and therefore the 
symbols of the bundle activator library 
+can be hidden with exception of the bundle activator create, start, stop and 
destroy functions.
+
+The benefits of hiding symbols for a bundle are:
+ - Smaller bundle libraries;
+ - Faster link-time and load-time;
+ - Smaller memory footprint;
+ - Better optimization opportunities.
+
+A downside is that it is harder to debug a bundle, but this is mostly when not 
compiling with the `-g` compiler flag.
+
+Note that to use and invoke C and C++ services from another bundle, there is 
no need to export the service symbols.
+For C++ this is only the case if the provided services is based on a C++ 
header-only interface and for C this is always
+the case, because C service structs does not result in any symbols.
+
+By default, the symbol visibility preset of the bundle activator library is 
configured to hidden.
+This can be changed by providing the`DO_NOT_CONFIGURE_SYMBOL_VISIBILTY` option 
in the `add_celix_bundle` CMake 
+function call.
+
+TODO
+The default symbol visibility configuration for bundles can be changed by 
setting 
+the `CELIX_CONFIGURE_BUNDLE_SYMBOL_VISIBILITY_TO_HIDDEN` CMake variable. The 
default value is `ON`.
+TODO
+
+The celix_bundle_activator.h header file ensures that the bundle activator 
symbols are exported.
+
+### Hiding symbols with celix_bundle_hide_symbols example
+```CMake
+add_celix_bundle(my_bundle_hide_symbols
+    VERSION 1.0.0
+    SOURCES src/my_bundle_activator.c
+)
+celix_bundle_hide_symbols(my_bundle_hide_symbols)
+```
+
 ## Installing bundles
 Apache Celix bundles can be installed on the system with the Apache Celix 
CMake command `install_celix_bundle`.
 Bundles will be installed as zip files in the package (default the 
CMAKE_PROJECT_NAME) share directory 
diff --git a/documents/cmake_commands/README.md 
b/documents/cmake_commands/README.md
index 3d966a4a..b55d1513 100644
--- a/documents/cmake_commands/README.md
+++ b/documents/cmake_commands/README.md
@@ -275,6 +275,29 @@ Example:
 celix_get_bundle_file(Celix::shell SHELL_BUNDLE_FILE)
 ```
 
+## celix_bundle_hide_symbols
+Configure the symbol visibility preset of the bundle library to hidden.
+
+This is done by setting the target properties C_VISIBILITY_PRESET to hidden, 
the CXX_VISIBILITY_PRESET to hidden and
+VISIBILITY_INLINES_HIDDEN to ON.
+
+```CMake
+celix_bundle_hide_symbols(<bundle_target> [RELEASE] [DEBUG] [RELWITHDEBINFO] 
[MINSIZEREL])
+```
+
+Optional arguments are:
+- RELEASE: hide symbols for the release build type
+- DEBUG: hide symbols for the debug build type
+- RELWITHDEBINFO: hide symbols for the relwithdebinfo build type
+- MINSIZEREL: hide symbols for the minsizerel build type
+
+If no optional arguments are provided, the symbols are hidden for all build 
types.
+
+Example:
+```CMake
+celix_bundle_hide_symbols(my_bundle RELEASE MINSIZEREL)
+```
+
 ## install_celix_bundle
 Install bundle when 'make install' is executed.
 
diff --git a/examples/celix-examples/readme_c_examples/CMakeLists.txt 
b/examples/celix-examples/readme_c_examples/CMakeLists.txt
index 3861fc4f..d8c08ec3 100644
--- a/examples/celix-examples/readme_c_examples/CMakeLists.txt
+++ b/examples/celix-examples/readme_c_examples/CMakeLists.txt
@@ -25,6 +25,12 @@ add_celix_bundle(my_bundle
     SOURCES src/my_bundle_activator.c
 )
 
+add_celix_bundle(my_bundle_hide_symbols
+    VERSION 1.0.0
+    SOURCES src/my_bundle_activator.c
+)
+celix_bundle_hide_symbols(my_bundle_hide_symbols)
+
 #With `make all`, `make celix-containers` or `make my_container` this Celix 
container executable will be created at:
 # ${CMAKE_BINARY_DIR}/deploy/my_container/my_container
 add_celix_container(my_container
@@ -33,6 +39,7 @@ add_celix_container(my_container
         Celix::shell
         Celix::shell_tui
         my_bundle
+        my_bundle_hide_symbols
 )
 
 add_celix_bundle(my_shell_command_provider_bundle
diff --git 
a/examples/celix-examples/readme_c_examples/src/my_bundle_activator.c 
b/examples/celix-examples/readme_c_examples/src/my_bundle_activator.c
index 54a4876c..35332de4 100644
--- a/examples/celix-examples/readme_c_examples/src/my_bundle_activator.c
+++ b/examples/celix-examples/readme_c_examples/src/my_bundle_activator.c
@@ -17,20 +17,29 @@
  * under the License.
  */
 
+#include <stdio.h>
 #include <celix_bundle_activator.h>
 
 typedef struct my_bundle_activator_data {
     /*the hello world bundle activator struct is empty*/
 } my_bundle_activator_data_t;
 
-static celix_status_t my_bundle_start(my_bundle_activator_data_t *data 
__attribute__((unused)), celix_bundle_context_t *ctx __attribute__((unused))) {
+void myBundle_helloWorld(celix_bundle_context_t* ctx) {
     printf("Hello world from bundle with id %li\n", 
celix_bundleContext_getBundleId(ctx));
+}
+
+void myBundle_goodbyeWorld(celix_bundle_context_t* ctx) {
+    printf("Goodbye world from bundle with id %li\n", 
celix_bundleContext_getBundleId(ctx));
+}
+
+static celix_status_t myBundle_start(my_bundle_activator_data_t *data 
__attribute__((unused)), celix_bundle_context_t *ctx __attribute__((unused))) {
+    myBundle_helloWorld(ctx);
     return CELIX_SUCCESS;
 }
 
-static celix_status_t my_bundle_stop(my_bundle_activator_data_t *data 
__attribute__((unused)), celix_bundle_context_t *ctx __attribute__((unused))) {
-    printf("Goodbye world\n");
+static celix_status_t myBundle_stop(my_bundle_activator_data_t *data 
__attribute__((unused)), celix_bundle_context_t *ctx __attribute__((unused))) {
+    myBundle_goodbyeWorld(ctx);
     return CELIX_SUCCESS;
 }
 
-CELIX_GEN_BUNDLE_ACTIVATOR(my_bundle_activator_data_t, my_bundle_start, 
my_bundle_stop)
\ No newline at end of file
+CELIX_GEN_BUNDLE_ACTIVATOR(my_bundle_activator_data_t, myBundle_start, 
myBundle_stop)
\ No newline at end of file
diff --git a/libs/framework/include/celix/BundleActivator.h 
b/libs/framework/include/celix/BundleActivator.h
index 34cab250..8fffadeb 100644
--- a/libs/framework/include/celix/BundleActivator.h
+++ b/libs/framework/include/celix/BundleActivator.h
@@ -147,20 +147,20 @@ namespace impl {
  * argument of std::shared_ptr<celix::BundleContext> or 
std::shared_ptr<DependencyManager>.
  */
 #define CELIX_GEN_CXX_BUNDLE_ACTIVATOR(actType)                                
                                        \
-extern "C" celix_status_t bundleActivator_create(celix_bundle_context_t 
*context, void** userData) {                   \
+extern "C" celix_status_t celix_bundleActivator_create(celix_bundle_context_t 
*context, void** userData) {             \
     return celix::impl::createActivator<actType>(context, userData);           
                                        \
 }                                                                              
                                        \
                                                                                
                                        \
-extern "C" celix_status_t bundleActivator_start(void *, celix_bundle_context_t 
*) {                                    \
+extern "C" celix_status_t celix_bundleActivator_start(void *, 
celix_bundle_context_t *) {                              \
     /*nop*/                                                                    
                                        \
     return CELIX_SUCCESS;                                                      
                                        \
 }                                                                              
                                        \
                                                                                
                                        \
-extern "C" celix_status_t bundleActivator_stop(void *userData, 
celix_bundle_context_t*) {                              \
+extern "C" celix_status_t celix_bundleActivator_stop(void *userData, 
celix_bundle_context_t*) {                        \
     return celix::impl::destroyActivator<actType>(userData);                   
                                        \
 }                                                                              
                                        \
                                                                                
                                        \
-extern "C" celix_status_t bundleActivator_destroy(void *, 
celix_bundle_context_t*) {                                   \
+extern "C" celix_status_t celix_bundleActivator_destroy(void *, 
celix_bundle_context_t*) {                             \
     /*nop*/                                                                    
                                        \
     return CELIX_SUCCESS;                                                      
                                        \
 }

Reply via email to