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

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


The following commit(s) were added to refs/heads/feature/bundle_hide_symbols by 
this push:
     new 1128583b Rewrite bundle symbol visibility paragraph
1128583b is described below

commit 1128583bc09565ab92b942ba92c98bd779a2f0e9
Author: Pepijn Noltes <pepijnnol...@gmail.com>
AuthorDate: Mon May 1 18:53:00 2023 +0200

    Rewrite bundle symbol visibility paragraph
---
 documents/bundles.md                               | 42 +++++++++++-----------
 .../readme_c_examples/src/my_bundle_activator.c    |  2 +-
 2 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/documents/bundles.md b/documents/bundles.md
index 393df83e..e033b48e 100644
--- a/documents/bundles.md
+++ b/documents/bundles.md
@@ -238,26 +238,28 @@ 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 celix_bundle_activator.h header file ensures that the bundle activator 
symbols are exported.
-
-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_VISIBILITY` 
option in the `add_celix_bundle` CMake 
-function call.
+## Bundle symbol visibility
+Since bundles are unable to directly access the symbols of another bundle, the 
default symbol visibility preset for the 
+bundle activator library is set to hidden. To modify this, supply the 
`DO_NOT_CONFIGURE_SYMBOL_VISIBILITY` option within the 
+`add_celix_bundle` CMake function call.
+
+Hiding symbols for a bundle offers several advantages, including:
+
+- Reduced bundle library size;
+- Faster link-time and load-time;
+- Lower memory usage;
+- Enhanced optimization possibilities.
+
+However, one drawback can be that debugging a bundle becomes more difficult, 
particularly when not using the -g 
+compiler flag.
+
+It's important to note that exporting service symbols isn't necessary when 
utilizing and invoking C and C++ services 
+from another bundle. For C++, this only applies when the provided services are 
based on a C++ header-only interface, 
+while for C, this is always the case since C service structs don't produce any 
symbols.
+
+The bundle activator symbols (create, start, stop, and destroy) must be 
exported as they are invoked by the 
+Apache Celix framework. For this reason, the bundle activator functions in 
`celix_bundle_activator.h` are marked for 
+export.
 
 ### Example of disabling hiding of symbols for a bundle
 ```CMake
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 35332de4..3aeff146 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
@@ -42,4 +42,4 @@ static celix_status_t 
myBundle_stop(my_bundle_activator_data_t *data __attribute
     return CELIX_SUCCESS;
 }
 
-CELIX_GEN_BUNDLE_ACTIVATOR(my_bundle_activator_data_t, myBundle_start, 
myBundle_stop)
\ No newline at end of file
+CELIX_GEN_BUNDLE_ACTIVATOR(my_bundle_activator_data_t, myBundle_start, 
myBundle_stop)

Reply via email to