You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2019/04/27 14:15:04 UTC

[celix] branch develop updated: CELIX-461: Refactoring of the celix examples in prep for a next release

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

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


The following commit(s) were added to refs/heads/develop by this push:
     new f67aed4  CELIX-461: Refactoring of the celix examples in prep for a next release
f67aed4 is described below

commit f67aed40d7c9fe1e64f5c4a69a8f3ed5bbf89b68
Author: Pepijn Noltes <pe...@gmail.com>
AuthorDate: Sat Apr 27 16:14:27 2019 +0200

    CELIX-461: Refactoring of the celix examples in prep for a next release
---
 .travis.yml                                        |   1 +
 cmake/cmake_celix/BundlePackaging.cmake            |   1 -
 .../getting_started/creating_a_simple_bundle.md    |   4 +-
 examples/celix-examples/CMakeLists.txt             |  15 ++-
 .../best_practice_example_c/CMakeLists.txt         |  40 --------
 .../best_practice_example_c/api/example.h          |  34 -------
 .../bar/private/src/bar_activator.c                |  52 ----------
 .../foo1/private/include/foo1.h                    |  36 -------
 .../foo1/private/src/foo1.c                        | 102 -------------------
 .../foo1/private/src/foo1_activator.c              |  75 --------------
 .../best_practice_example_c/foo2/CMakeLists.txt    |  28 -----
 .../foo2/private/include/foo2.h                    |  36 -------
 .../foo2/private/src/foo2.c                        | 113 ---------------------
 .../foo2/private/src/foo2_activator.c              |  77 --------------
 .../bar => bundle_with_private_lib}/CMakeLists.txt |  27 +++--
 .../src/activator.c}                               |  48 ++++-----
 .../tlib}/include/test.h                           |   9 +-
 .../tlib}/src/test.c                               |  14 +--
 .../celix-examples/civetweb/src/bundle_activator.c |  10 +-
 examples/celix-examples/dm_example/CMakeLists.txt  |   1 -
 .../dm_example/phase1/src/phase1_activator.c       |  16 +--
 .../dm_example/phase2a/src/phase2a_activator.c     |   8 +-
 .../dm_example/phase2b/src/phase2b_activator.c     |  16 +--
 .../dm_example/phase3/src/phase3_activator.c       |  16 +--
 .../dm_example_cxx/phase1/src/Phase1Activator.cc   |   2 +-
 .../dm_example_cxx/phase2/src/Phase2aActivator.cc  |   2 +-
 .../dm_example_cxx/phase3/src/Phase3Activator.cc   |   2 +-
 .../phase3_locking/src/Phase3LockingActivator.cc   |   2 +-
 examples/celix-examples/embedding/CMakeLists.txt   |   2 +-
 .../celix-examples/embedding/private/src/main.c    |  99 ------------------
 examples/celix-examples/embedding/src/main.c       |  72 +++++++++++++
 .../{hello_world => export_import}/CMakeLists.txt  |   3 -
 .../public => export_import}/include/test.h        |   0
 .../public => export_import}/include/test2.h       |   0
 .../private => export_import}/src/activator.c      |   0
 .../private => export_import}/src/test.c           |   0
 .../private => export_import}/src/test2.c          |   0
 .../CMakeLists.txt                                 |   6 +-
 .../src/bundle_activator.c                         |   3 +-
 .../foo1 => hello_world_cxx}/CMakeLists.txt        |  20 ++--
 .../src/BundleActivator.cc}                        |  29 ++++--
 .../celix-examples/hello_world_test/CMakeLists.txt |  90 ----------------
 .../hello_world_test/private/src/activator.c       |  63 ------------
 .../log_service_example/src/activator.c            |  80 +++++++--------
 examples/celix-examples/readme.md                  |   3 +
 .../src/dynamic_consumer_example.c                 |   2 +-
 .../src/dynamic_provider_example.c                 |   4 +-
 .../src/simple_consumer_example.c                  |   5 +-
 .../src/simple_provider_example.c                  |   3 +-
 .../services_example_cxx/bar/src/BarActivator.cc   |   3 +-
 .../services_example_cxx/baz/src/BazActivator.cc   |   2 +-
 .../services_example_cxx/foo/src/FooActivator.cc   |   2 +-
 libs/framework/include/celix/dm/Component_Impl.h   |  23 +----
 libs/framework/include/celix_api.h                 |   5 +
 54 files changed, 245 insertions(+), 1061 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 9975aba..40826c9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -27,6 +27,7 @@ matrix:
        - os: osx
          osx_image: xcode10.2
          compiler: clang
+         env: MACOSX_DEPLOYMENT_TARGET=10.14
        - os: linux
          dist: trusty
          compiler: gcc
diff --git a/cmake/cmake_celix/BundlePackaging.cmake b/cmake/cmake_celix/BundlePackaging.cmake
index a79ef03..e67650b 100644
--- a/cmake/cmake_celix/BundlePackaging.cmake
+++ b/cmake/cmake_celix/BundlePackaging.cmake
@@ -347,7 +347,6 @@ function(celix_bundle_libs)
             list(APPEND DEPS ${OUT}) 
         elseif (TARGET ${LIB})
             get_target_property(TARGET_TYPE ${LIB} TYPE)
-            #Assuming target
             #NOTE add_custom_command does not support generator expression in OUTPUT value (e.g. $<TARGET_FILE:${LIB}>)
             #Using a two step approach to be able to use add_custom_command instead of add_custom_target
             set(OUT "${BUNDLE_GEN_DIR}/lib-${LIBID}-copy-timestamp")
diff --git a/documents/getting_started/creating_a_simple_bundle.md b/documents/getting_started/creating_a_simple_bundle.md
index 713db31..5e2b3e6 100644
--- a/documents/getting_started/creating_a_simple_bundle.md
+++ b/documents/getting_started/creating_a_simple_bundle.md
@@ -84,10 +84,10 @@ This CMakeLists.txt file, sets up the following:
 	* The Celix package should be searched, configured and that the Celix package is required. 
 	* For all build targets in this CMakeLists.txt file or any sub directory CMakeLists.txt files the Apache Celix headers directory should be included.
 * Part 4
-	* The CMakelists.txt file in the subdirectory bundles/hello_world and/or bundles/HelloWorld should also be processed.
+	* The CMakelists.txt file in the subdirectory bundles/export_import and/or bundles/HelloWorld should also be processed.
 	
 
-It is a good practice to create a separate CMakeLists.txt file for every bundle you want to build. For the hello_world bundle a CMakeLists.txt file should be created in the bundles/hello_world sub directory.
+It is a good practice to create a separate CMakeLists.txt file for every bundle you want to build. For the export_import bundle a CMakeLists.txt file should be created in the bundles/export_import sub directory.
 
 Create the sub directory:
 
diff --git a/examples/celix-examples/CMakeLists.txt b/examples/celix-examples/CMakeLists.txt
index af34f71..ea137e3 100644
--- a/examples/celix-examples/CMakeLists.txt
+++ b/examples/celix-examples/CMakeLists.txt
@@ -23,24 +23,23 @@ endif ()
 if (EXAMPLES)
     add_definitions(-DADD_CELIX_DEPRECATED_WARNING) #ensure that no deprecated api is used in the examples
 
-    add_subdirectory(bundle_example_c)
+    add_subdirectory(hello_world_c)
+    add_subdirectory(hello_world_cxx)
 
-    add_subdirectory(hello_world)
-    add_subdirectory(hello_world_test)
+    add_subdirectory(dm_example)
+    add_subdirectory(dm_example_cxx)
 
     add_subdirectory(services_example_c)
-
-    add_subdirectory(best_practice_example_c)
     add_subdirectory(services_example_cxx)
 
-    add_subdirectory(dm_example)
-    add_subdirectory(dm_example_cxx)
-
+    #TODO refactor export_import
+    #add_subdirectory(export_import)
     if (NOT ANDROID)
         add_subdirectory(civetweb)
     endif()
     add_subdirectory(embedding)
     add_subdirectory(track_tracker_example)
     add_subdirectory(log_service_example)
+    add_subdirectory(bundle_with_private_lib)
 
 endif(EXAMPLES)
diff --git a/examples/celix-examples/best_practice_example_c/CMakeLists.txt b/examples/celix-examples/best_practice_example_c/CMakeLists.txt
deleted file mode 100644
index 075a6e7..0000000
--- a/examples/celix-examples/best_practice_example_c/CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-# 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.
-
-include_directories(
-        ${PROJECT_SOURCE_DIR}/dependency_manager/public/include
-        ${PROJECT_SOURCE_DIR}/utils/public/include
-        api
-)
-
-add_subdirectory(foo1)
-add_subdirectory(foo2)
-add_subdirectory(bar)
-
-add_celix_container(best_practice_example_c
-    GROUP services_example
-    COPY
-    BUNDLES
-        Celix::shell
-        Celix::shell_tui
-        dm_shell
-        bar
-        foo1
-        foo2
-    PROPERTIES
-        example=value
-)
diff --git a/examples/celix-examples/best_practice_example_c/api/example.h b/examples/celix-examples/best_practice_example_c/api/example.h
deleted file mode 100644
index b0e0166..0000000
--- a/examples/celix-examples/best_practice_example_c/api/example.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- *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.
- */
-#ifndef EXAMPLE_H_
-#define EXAMPLE_H_
-
-#define EXAMPLE_NAME 			"org.example"
-#define EXAMPLE_VERSION 		"1.0.0"
-#define EXAMPLE_CONSUMER_RANGE   "[1.0.0,2.0.0)"
-
-
-struct example_struct {
-	void *handle;
-	int (*method)(void *handle, int arg1, double arg2, double *result);
-} ;
-
-typedef struct example_struct example_t;
-
-#endif /* EXAMPLE_H_ */
diff --git a/examples/celix-examples/best_practice_example_c/bar/private/src/bar_activator.c b/examples/celix-examples/best_practice_example_c/bar/private/src/bar_activator.c
deleted file mode 100644
index 25e82b0..0000000
--- a/examples/celix-examples/best_practice_example_c/bar/private/src/bar_activator.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- *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.
- */
-
-#include "celix_api.h"
-#include "bar.h"
-
-#include <stdlib.h>
-
-typedef struct activator {
-	bar_t *bar;
-	example_t exampleService;
-} activator_t;
-
-static celix_status_t activator_start(activator_t *act, celix_bundle_context_t *ctx) {
-	celix_status_t status = CELIX_SUCCESS;
-	act->bar = bar_create();
-	act->exampleService.handle = act->bar;
-	act->exampleService.method = (void*) bar_method;
-	if (act->bar == NULL) {
-		status = CELIX_ENOMEM;
-	} else {
-		celix_dm_component_t *cmp = celix_dmComponent_create(ctx, "BAR");
-        celix_dmComponent_setImplementation(cmp, act->bar);
-        celix_dmComponent_addInterface(cmp, EXAMPLE_NAME, EXAMPLE_VERSION, &act->exampleService, NULL);
-		celix_dependencyManager_add(celix_bundleContext_getDependencyManager(ctx), cmp);
-	}
-	return status;
-}
-
-static celix_status_t activator_stop(activator_t *act, celix_bundle_context_t *ctx) {
-	celix_dependencyManager_removeAllComponents(celix_bundleContext_getDependencyManager(ctx));
-	bar_destroy(act->bar);
-	return CELIX_SUCCESS;
-}
-
-CELIX_GEN_BUNDLE_ACTIVATOR(activator_t, activator_start, activator_stop)
\ No newline at end of file
diff --git a/examples/celix-examples/best_practice_example_c/foo1/private/include/foo1.h b/examples/celix-examples/best_practice_example_c/foo1/private/include/foo1.h
deleted file mode 100644
index f556b44..0000000
--- a/examples/celix-examples/best_practice_example_c/foo1/private/include/foo1.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *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.
- */
-
-#ifndef FOO1_H_
-#define FOO1_H_
-
-#include "example.h"
-
-typedef struct foo1_struct foo1_t;
-
-foo1_t* foo1_create(void);
-void foo1_destroy(foo1_t *self);
-
-int foo1_start(foo1_t *self);
-int foo1_stop(foo1_t *self);
-
-int foo1_setExample(foo1_t *self, const example_t *example);
-
-
-#endif //FOO1_H_
diff --git a/examples/celix-examples/best_practice_example_c/foo1/private/src/foo1.c b/examples/celix-examples/best_practice_example_c/foo1/private/src/foo1.c
deleted file mode 100644
index 1f1f56f..0000000
--- a/examples/celix-examples/best_practice_example_c/foo1/private/src/foo1.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- *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.
- */
-
-#include "foo1.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-#include <stdbool.h>
-#include <pthread.h>
-#include <assert.h>
-
-
-#define OK 0
-#define ERROR 1
-
-static void* foo1_thread(void*);
-
-struct foo1_struct {
-    const example_t *example;
-    pthread_mutex_t mutex; //protecting example
-    pthread_t thread;
-    bool running;
-};
-
-foo1_t* foo1_create(void) {
-    foo1_t *self = calloc(1, sizeof(*self));
-    if (self != NULL) {
-        pthread_mutex_init(&self->mutex, NULL);
-        self->running = false;
-    } else {
-        //log error
-    }
-    return self;
-};
-
-void foo1_destroy(foo1_t *self) {
-    assert(!self->running);
-    pthread_mutex_destroy(&self->mutex);
-    free(self);
-}
-
-int foo1_start(foo1_t *self) {
-    printf("starting foo1\n");
-    self->running = true;
-    pthread_create(&self->thread, NULL, foo1_thread, self);
-    return OK;
-}
-
-int foo1_stop(foo1_t *self) {
-    printf("stopping foo1\n");
-    self->running = false;
-    pthread_kill(self->thread, SIGUSR1);
-    pthread_join(self->thread, NULL);
-    return OK;
-}
-
-int foo1_setExample(foo1_t *self, const example_t *example) {
-    printf("Setting example %p for foo1\n", example);
-    pthread_mutex_lock(&self->mutex);
-    self->example = example; //NOTE could be NULL if req is not mandatory
-    pthread_mutex_unlock(&self->mutex);
-    return OK;
-}
-
-static void* foo1_thread(void *userdata) {
-    foo1_t *self = userdata;
-    double result;
-    int rc;
-    while (self->running) {
-        pthread_mutex_lock(&self->mutex);
-        if (self->example != NULL) {
-            rc = self->example->method(self->example->handle, 1, 2.0, &result);
-            if (rc == 0) {
-                printf("Result is %f\n", result);
-            } else {
-                printf("Error invoking method for example\n");
-            }
-        }
-        pthread_mutex_unlock(&self->mutex);
-        usleep(30000000);
-    }
-    return NULL;
-}
\ No newline at end of file
diff --git a/examples/celix-examples/best_practice_example_c/foo1/private/src/foo1_activator.c b/examples/celix-examples/best_practice_example_c/foo1/private/src/foo1_activator.c
deleted file mode 100644
index 4098117..0000000
--- a/examples/celix-examples/best_practice_example_c/foo1/private/src/foo1_activator.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- *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.
- */
-
-#include "celix_api.h"
-#include "foo1.h"
-
-#include <stdlib.h>
-
-typedef struct activator {
-	foo1_t *foo;
-} activator_t;
-
-static celix_status_t activator_start(activator_t *act, celix_bundle_context_t *ctx) {
-	celix_status_t status = CELIX_SUCCESS;
-	act->foo = foo1_create();
-	if (act->foo == NULL) {
-		status = CELIX_ENOMEM;
-	} else {
-		celix_dm_component_t *cmp = celix_dmComponent_create(ctx, "FOO1");
-		celix_dmComponent_setImplementation(cmp, act->foo);
-
-		/*
-        With the component_setCallbacksSafe we register callbacks when a component is started / stopped using a component
-         with type foo1_t*
-        */
-		CELIX_DMCOMPONENT_SETCALLBACKS(cmp, foo1_t*, NULL, foo1_start, foo1_stop, NULL);
-
-		celix_dm_service_dependency_t *dep = celix_dmServiceDependency_create();
-		celix_dmServiceDependency_setRequired(dep, true);
-		celix_dmServiceDependency_setService(dep, EXAMPLE_NAME, EXAMPLE_CONSUMER_RANGE, NULL);
-		celix_dmServiceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING);
-
-		/*
-        With the serviceDependency_setCallbacksSafe we register callbacks when a service
-        is added and about to be removed for the component type foo1_t* and service type example_t*.
-
-        We should protect the usage of the
-         service because after removal of the service the memory location of that service
-        could be freed
-        */
-		celix_dm_service_dependency_callback_options_t opts = CELIX_EMPTY_DM_SERVICE_DEPENDENCY_CALLBACK_OPTIONS;
-		opts.set = (void*)foo1_setExample;
-		celix_dmServiceDependency_setCallbacksWithOptions(dep, &opts);
-        celix_dmComponent_addServiceDependency(cmp, dep);
-
-		celix_dependencyManager_add(celix_bundleContext_getDependencyManager(ctx), cmp);
-
-	}
-	return status;
-}
-
-static celix_status_t activator_stop(activator_t *act, celix_bundle_context_t *ctx) {
-	celix_dependencyManager_removeAllComponents(celix_bundleContext_getDependencyManager(ctx));
-	foo1_destroy(act->foo);
-	return CELIX_SUCCESS;
-}
-
-
-CELIX_GEN_BUNDLE_ACTIVATOR(activator_t, activator_start, activator_stop)
\ No newline at end of file
diff --git a/examples/celix-examples/best_practice_example_c/foo2/CMakeLists.txt b/examples/celix-examples/best_practice_example_c/foo2/CMakeLists.txt
deleted file mode 100644
index f3dd0f3..0000000
--- a/examples/celix-examples/best_practice_example_c/foo2/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# 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.
-
-include_directories(
-        private/include
-)
-
-add_celix_bundle(foo2
-    SYMBOLIC_NAME foo2
-    VERSION 1.0.0
-    SOURCES
-        private/src/foo2_activator
-        private/src/foo2.c
-)
\ No newline at end of file
diff --git a/examples/celix-examples/best_practice_example_c/foo2/private/include/foo2.h b/examples/celix-examples/best_practice_example_c/foo2/private/include/foo2.h
deleted file mode 100644
index 9f09276..0000000
--- a/examples/celix-examples/best_practice_example_c/foo2/private/include/foo2.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *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.
- */
-
-#ifndef FOO2_H_
-#define FOO2_H_
-
-#include "example.h"
-
-typedef struct foo2_struct foo2_t;
-
-foo2_t* foo2_create(void);
-void foo2_destroy(foo2_t *self);
-
-int foo2_start(foo2_t *self);
-int foo2_stop(foo2_t *self);
-
-int foo2_addExample(foo2_t *self, const example_t *example);
-int foo2_removeExample(foo2_t *self, const example_t *example);
-
-#endif //FOO2_H_
\ No newline at end of file
diff --git a/examples/celix-examples/best_practice_example_c/foo2/private/src/foo2.c b/examples/celix-examples/best_practice_example_c/foo2/private/src/foo2.c
deleted file mode 100644
index 4a1482c..0000000
--- a/examples/celix-examples/best_practice_example_c/foo2/private/src/foo2.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- *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.
- */
-
-#include "foo2.h"
-
-#include "array_list.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-#include <stdbool.h>
-#include <pthread.h>
-#include <assert.h>
-
-
-#define OK 0
-#define ERROR 1
-
-static void* foo2_thread(void*);
-
-struct foo2_struct {
-    celix_array_list_t *examples;
-    pthread_t thread;
-    bool running;
-};
-
-foo2_t* foo2_create(void) {
-    foo2_t *self = calloc(1, sizeof(*self));
-    if (self != NULL) {
-        self->examples = NULL;
-        arrayList_create(&self->examples);
-        self->running = false;
-    } else {
-        //log error
-    }
-    return self;
-};
-
-void foo2_destroy(foo2_t *self) {
-    assert(!self->running);
-    arrayList_destroy(self->examples);
-    free(self);
-}
-
-int foo2_start(foo2_t *self) {
-    printf("starting foo2\n");
-    self->running = true;
-    pthread_create(&self->thread, NULL, foo2_thread, self);
-    return OK;
-}
-
-int foo2_stop(foo2_t *self) {
-    printf("stopping foo2\n");
-    self->running = false;
-    pthread_kill(self->thread, SIGUSR1);
-    pthread_join(self->thread, NULL);
-    return OK;
-}
-
-int foo2_addExample(foo2_t *self, const example_t *example) {
-    //NOTE foo2 is suspended -> thread is not running  -> safe to update
-    int status = OK;
-    printf("Adding example %p for foo2\n", example);
-    status = arrayList_add(self->examples, (void *)example);
-    return status;
-}
-
-int foo2_removeExample(foo2_t *self, const example_t *example) {
-    //NOTE foo2 is suspended -> thread is not running  -> safe to update
-    int status = OK;
-    printf("Removing example %p for foo2\n", example);
-    status = arrayList_removeElement(self->examples, (void*)example);
-    return status;
-}
-
-static void* foo2_thread(void *userdata) {
-    foo2_t *self = userdata;
-    double result;
-    int rc;
-    while (self->running) {
-        unsigned int size = arrayList_size(self->examples);
-        int i;
-        for (i = 0; i < size; i += 1) {
-            const example_t* example = arrayList_get(self->examples, i);
-            rc = example->method(example->handle, 1, 2.0, &result);
-            if (rc == 0) {
-                printf("Result is %f\n", result);
-            } else {
-                printf("Error invoking method for example\n");
-            }
-        }
-        usleep(15000000);
-    }
-    return NULL;
-}
\ No newline at end of file
diff --git a/examples/celix-examples/best_practice_example_c/foo2/private/src/foo2_activator.c b/examples/celix-examples/best_practice_example_c/foo2/private/src/foo2_activator.c
deleted file mode 100644
index 9765e35..0000000
--- a/examples/celix-examples/best_practice_example_c/foo2/private/src/foo2_activator.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- *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.
- */
-
-#include "celix_api.h"
-#include "foo2.h"
-
-#include <stdlib.h>
-
-struct activator {
-	foo2_t *foo;
-};
-
-static celix_status_t activator_start(struct activator *act, celix_bundle_context_t *ctx) {
-	celix_status_t status = CELIX_SUCCESS;
-	act->foo = foo2_create();
-	if (act->foo == NULL) {
-		status = CELIX_ENOMEM;
-	} else {
-
-		celix_dm_component_t *cmp = celix_dmComponent_create(ctx, "FOO2");
-		celix_dmComponent_setImplementation(cmp, act->foo);
-
-		/*
-		With the component_setCallbacksSafe we register callbacks when a component is started / stopped using a component
-		 with type foo1_t*
-		*/
-		CELIX_DMCOMPONENT_SETCALLBACKS(cmp, foo2_t*, NULL, foo2_start, foo2_stop, NULL);
-
-		celix_dm_service_dependency_t *dep = celix_dmServiceDependency_create();
-		celix_dmServiceDependency_setRequired(dep, false);
-		celix_dmServiceDependency_setService(dep, EXAMPLE_NAME, EXAMPLE_CONSUMER_RANGE, NULL);
-		celix_dmServiceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND);
-
-		/*
-		With the serviceDependency_setCallbacksSafe we register callbacks when a service
-		is added and about to be removed for the component type foo1_t* and service type example_t*.
-
-		We should protect the usage of the
-		service because after removal of the service the memory location of that service
-		could be freed
-		*/
-		celix_dm_service_dependency_callback_options_t opts = CELIX_EMPTY_DM_SERVICE_DEPENDENCY_CALLBACK_OPTIONS;
-		opts.add = (void*)foo2_addExample;
-		opts.remove = (void*)foo2_removeExample;
-		celix_dmServiceDependency_setCallbacksWithOptions(dep, &opts);
-		celix_dmComponent_addServiceDependency(cmp, dep);
-
-		celix_dependencyManager_add(celix_bundleContext_getDependencyManager(ctx), cmp);
-	}
-
-	return status;
-}
-
-static celix_status_t activator_stop(struct activator *act, celix_bundle_context_t *ctx) {
-	celix_dependencyManager_removeAllComponents(celix_bundleContext_getDependencyManager(ctx));
-	foo2_destroy(act->foo);
-	return CELIX_SUCCESS;
-}
-
-
-CELIX_GEN_BUNDLE_ACTIVATOR(struct activator, activator_start, activator_stop)
\ No newline at end of file
diff --git a/examples/celix-examples/best_practice_example_c/bar/CMakeLists.txt b/examples/celix-examples/bundle_with_private_lib/CMakeLists.txt
similarity index 61%
rename from examples/celix-examples/best_practice_example_c/bar/CMakeLists.txt
rename to examples/celix-examples/bundle_with_private_lib/CMakeLists.txt
index 38083ae..3d14afa 100644
--- a/examples/celix-examples/best_practice_example_c/bar/CMakeLists.txt
+++ b/examples/celix-examples/bundle_with_private_lib/CMakeLists.txt
@@ -15,14 +15,25 @@
 # specific language governing permissions and limitations
 # under the License.
 
-include_directories(
-        private/include
+add_library(tlib SHARED
+        tlib/src/test.c
 )
+target_include_directories(tlib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tlib/include)
+set_library_version(tlib "4.3.2") # sets target propery VERSION to 4.3.2 and SOVERSION to 4
 
-add_celix_bundle(bar
-    SYMBOLIC_NAME bar
-    VERSION 1.0.0
+add_celix_bundle(hellotest
+    VERSION "1.2"
     SOURCES
-        private/src/bar_activator
-        private/src/bar.c
-)
\ No newline at end of file
+        src/activator.c
+)
+celix_bundle_headers(hellotest
+    "X-WebContent: web"
+    "X-MediaType: application/json"
+)
+celix_bundle_private_libs(hellotest tlib)
+
+add_celix_container(hello_world_test_cnt
+    BUNDLES
+        hellotest
+)
+
diff --git a/examples/celix-examples/best_practice_example_c/bar/private/src/bar.c b/examples/celix-examples/bundle_with_private_lib/src/activator.c
similarity index 57%
rename from examples/celix-examples/best_practice_example_c/bar/private/src/bar.c
rename to examples/celix-examples/bundle_with_private_lib/src/activator.c
index 5099201..a98346c 100644
--- a/examples/celix-examples/best_practice_example_c/bar/private/src/bar.c
+++ b/examples/celix-examples/bundle_with_private_lib/src/activator.c
@@ -17,42 +17,30 @@
  *under the License.
  */
 
-#include "bar.h"
-
-#include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-#include <stdbool.h>
-#include <pthread.h>
-#include <assert.h>
+#include <stdio.h>
 
+#include <celix_api.h>
+#include <test.h>
 
-#define OK 0
-#define ERROR 1
 
-struct bar_struct {
-    double prefValue;
+struct userData {
+	const char * word;
 };
 
-bar_t* bar_create(void) {
-    bar_t *self = calloc(1, sizeof(*self));
-    if (self != NULL) {
-        self->prefValue = 42;
-    } else {
-        //log error
-    }
-    return self;
-};
+static celix_status_t activator_start(struct userData *data, celix_bundle_context_t *ctx) {
+	data->word = "Import";
+	const char *bndName = celix_bundle_getSymbolicName(celix_bundleContext_getBundle(ctx));
+	printf("Hello %s\n", data->word);
+	doo(bndName);
+	return CELIX_SUCCESS;
+}
 
-void bar_destroy(bar_t *self) {
-    free(self);
+static celix_status_t activator_stop(struct userData *data, celix_bundle_context_t *ctx __attribute__((unused))) {
+	printf("Goodbye %s\n", data->word);
+	return CELIX_SUCCESS;
 }
 
-int bar_method(bar_t *self, int arg1, double arg2, double *out) {
-    double update = (self->prefValue + arg1) * arg2;
-    self->prefValue = update;
-    *out = update;
-    return OK;
-}
\ No newline at end of file
+
+
+CELIX_GEN_BUNDLE_ACTIVATOR(struct userData, activator_start, activator_stop)
\ No newline at end of file
diff --git a/examples/celix-examples/hello_world/public/include/test.h b/examples/celix-examples/bundle_with_private_lib/tlib/include/test.h
similarity index 81%
rename from examples/celix-examples/hello_world/public/include/test.h
rename to examples/celix-examples/bundle_with_private_lib/tlib/include/test.h
index cdbd05d..c037c00 100644
--- a/examples/celix-examples/hello_world/public/include/test.h
+++ b/examples/celix-examples/bundle_with_private_lib/tlib/include/test.h
@@ -16,19 +16,12 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/*
- * test.h
- *
- *  \date       12 Feb 2014
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
 
 #ifndef TEST_H_
 #define TEST_H_
 
 
-void doo(void);
+void doo(const char *bndName);
 
 
 #endif /* TEST_H_ */
diff --git a/examples/celix-examples/hello_world/private/src/test.c b/examples/celix-examples/bundle_with_private_lib/tlib/src/test.c
similarity index 78%
rename from examples/celix-examples/hello_world/private/src/test.c
rename to examples/celix-examples/bundle_with_private_lib/tlib/src/test.c
index 280fc61..296b8c1 100644
--- a/examples/celix-examples/hello_world/private/src/test.c
+++ b/examples/celix-examples/bundle_with_private_lib/tlib/src/test.c
@@ -16,17 +16,13 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/*
- * test.c
- *
- *  \date       12 Feb 2014
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
 
 #include <stdio.h>
+#include <dlfcn.h>
 
-void doo()
+void doo(const char *bndName)
 {
-    printf("Hello from second lib\n");
+    Dl_info info;
+    dladdr(doo, &info);
+    printf("Hello from lib @ '%s' called by bundle '%s'\n", info.dli_fname, bndName);
 }
diff --git a/examples/celix-examples/civetweb/src/bundle_activator.c b/examples/celix-examples/civetweb/src/bundle_activator.c
index 3dcd490..0331b9d 100644
--- a/examples/celix-examples/civetweb/src/bundle_activator.c
+++ b/examples/celix-examples/civetweb/src/bundle_activator.c
@@ -18,16 +18,16 @@
  */
 
 
-#include "celix_bundle_activator.h"
-#include "celix_bundle.h"
-#include "shell.h"
-#include "celix_utils_api.h" //for open_memstream for APPLE,BSD,ANDROID
 
-#include <civetweb.h>
 #include <string.h>
 #include <stdio.h>
 
 
+#include <celix_api.h>
+#include <shell.h>
+#include <civetweb.h>
+
+
 typedef struct activator_data {
     celix_bundle_context_t *ctx;
     char *root;
diff --git a/examples/celix-examples/dm_example/CMakeLists.txt b/examples/celix-examples/dm_example/CMakeLists.txt
index a3986f8..49f2c11 100644
--- a/examples/celix-examples/dm_example/CMakeLists.txt
+++ b/examples/celix-examples/dm_example/CMakeLists.txt
@@ -16,7 +16,6 @@
 # under the License.
 
 add_subdirectory(api)
-
 add_subdirectory(phase1)
 add_subdirectory(phase2a)
 add_subdirectory(phase2b)
diff --git a/examples/celix-examples/dm_example/phase1/src/phase1_activator.c b/examples/celix-examples/dm_example/phase1/src/phase1_activator.c
index 985002a..542e1ab 100644
--- a/examples/celix-examples/dm_example/phase1/src/phase1_activator.c
+++ b/examples/celix-examples/dm_example/phase1/src/phase1_activator.c
@@ -16,17 +16,11 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/*
- * activator.c
- *
- *  \date       Oct 29, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
+
 #include <stdlib.h>
 #include <phase1_cmp.h>
 
-#include "celix_api.h"
+#include <celix_api.h>
 
 #include "phase1.h"
 
@@ -35,7 +29,7 @@ struct phase1_activator_struct {
 	phase1_t phase1Serv;
 };
 
-static celix_status_t start(struct phase1_activator_struct *act, celix_bundle_context_t *ctx) {
+static celix_status_t activator_start(struct phase1_activator_struct *act, celix_bundle_context_t *ctx) {
 	celix_status_t status = CELIX_SUCCESS;
 	printf("PHASE1: start\n");
 	act->phase1Cmp = phase1_create();
@@ -61,7 +55,7 @@ static celix_status_t start(struct phase1_activator_struct *act, celix_bundle_co
 	return status;
 }
 
-static celix_status_t stop(struct phase1_activator_struct *act, celix_bundle_context_t *ctx) {
+static celix_status_t activator_stop(struct phase1_activator_struct *act, celix_bundle_context_t *ctx) {
 	printf("PHASE1: stop\n");
 	celix_dependency_manager_t *mng = celix_bundleContext_getDependencyManager(ctx);
 	celix_dependencyManager_removeAllComponents(mng);
@@ -72,4 +66,4 @@ static celix_status_t stop(struct phase1_activator_struct *act, celix_bundle_con
 	return CELIX_SUCCESS;
 }
 
-CELIX_GEN_BUNDLE_ACTIVATOR(struct phase1_activator_struct, start, stop);
\ No newline at end of file
+CELIX_GEN_BUNDLE_ACTIVATOR(struct phase1_activator_struct, activator_start, activator_stop);
\ No newline at end of file
diff --git a/examples/celix-examples/dm_example/phase2a/src/phase2a_activator.c b/examples/celix-examples/dm_example/phase2a/src/phase2a_activator.c
index 04c0512..9cfad7d 100644
--- a/examples/celix-examples/dm_example/phase2a/src/phase2a_activator.c
+++ b/examples/celix-examples/dm_example/phase2a/src/phase2a_activator.c
@@ -20,7 +20,7 @@
 #include <stdlib.h>
 #include <phase2a_cmp.h>
 
-#include "celix_api.h"
+#include <celix_api.h>
 
 #include "phase1.h"
 #include "phase2.h"
@@ -31,7 +31,7 @@ struct phase2a_activator_struct {
 	phase2_t phase2Serv;
 };
 
-static celix_status_t start(struct phase2a_activator_struct *act, celix_bundle_context_t *ctx) {
+static celix_status_t activator_start(struct phase2a_activator_struct *act, celix_bundle_context_t *ctx) {
 	printf("phase2a: start\n");
 	celix_status_t status = CELIX_SUCCESS;
 	act->phase2aCmp = phase2a_create();
@@ -65,7 +65,7 @@ static celix_status_t start(struct phase2a_activator_struct *act, celix_bundle_c
 	return status;
 }
 
-static celix_status_t stop(struct phase2a_activator_struct *act, celix_bundle_context_t *ctx) {
+static celix_status_t activator_stop(struct phase2a_activator_struct *act, celix_bundle_context_t *ctx) {
 	printf("phase2a: stop\n");
     celix_dependency_manager_t *mng = celix_bundleContext_getDependencyManager(ctx);
     celix_dependencyManager_removeAllComponents(mng);
@@ -75,4 +75,4 @@ static celix_status_t stop(struct phase2a_activator_struct *act, celix_bundle_co
 	return CELIX_SUCCESS;
 }
 
-CELIX_GEN_BUNDLE_ACTIVATOR(struct phase2a_activator_struct, start, stop)
+CELIX_GEN_BUNDLE_ACTIVATOR(struct phase2a_activator_struct, activator_start, activator_stop)
diff --git a/examples/celix-examples/dm_example/phase2b/src/phase2b_activator.c b/examples/celix-examples/dm_example/phase2b/src/phase2b_activator.c
index 328b48a..12fdb81 100644
--- a/examples/celix-examples/dm_example/phase2b/src/phase2b_activator.c
+++ b/examples/celix-examples/dm_example/phase2b/src/phase2b_activator.c
@@ -16,17 +16,11 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/*
- * activator.c
- *
- *  \date       Oct 29, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
+
 #include <stdlib.h>
 #include <phase2b_cmp.h>
 
-#include "celix_api.h"
+#include <celix_api.h>
 
 #include "phase1.h"
 #include "phase2.h"
@@ -37,7 +31,7 @@ struct phase2b_activator_struct {
 	phase2_t phase2Serv;
 };
 
-static celix_status_t start(struct phase2b_activator_struct *act, celix_bundle_context_t *ctx) {
+static celix_status_t activator_start(struct phase2b_activator_struct *act, celix_bundle_context_t *ctx) {
 	printf("phase2b: start\n");
 	celix_status_t status = CELIX_SUCCESS;
 	act->phase2bCmp = phase2b_create();
@@ -71,7 +65,7 @@ static celix_status_t start(struct phase2b_activator_struct *act, celix_bundle_c
 	return status;
 }
 
-static celix_status_t stop(struct phase2b_activator_struct *act, celix_bundle_context_t *ctx) {
+static celix_status_t activator_stop(struct phase2b_activator_struct *act, celix_bundle_context_t *ctx) {
 	printf("phase2b: stop\n");
 	celix_dependency_manager_t *mng = celix_bundleContext_getDependencyManager(ctx);
 	celix_dependencyManager_removeAllComponents(mng);
@@ -82,4 +76,4 @@ static celix_status_t stop(struct phase2b_activator_struct *act, celix_bundle_co
 }
 
 
-CELIX_GEN_BUNDLE_ACTIVATOR(struct phase2b_activator_struct, start, stop)
+CELIX_GEN_BUNDLE_ACTIVATOR(struct phase2b_activator_struct, activator_start, activator_stop)
diff --git a/examples/celix-examples/dm_example/phase3/src/phase3_activator.c b/examples/celix-examples/dm_example/phase3/src/phase3_activator.c
index 7401776..2fb38ca 100644
--- a/examples/celix-examples/dm_example/phase3/src/phase3_activator.c
+++ b/examples/celix-examples/dm_example/phase3/src/phase3_activator.c
@@ -16,16 +16,10 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/*
- * activator.c
- *
- *  \date       Oct 29, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
+
 #include <stdlib.h>
 
-#include "celix_api.h"
+#include <celix_api.h>
 
 #include "phase2.h"
 #include "phase3_cmp.h"
@@ -34,7 +28,7 @@ struct phase3_activator_struct {
     phase3_cmp_t *phase3Cmp;
 };
 
-static celix_status_t start(struct phase3_activator_struct *act, celix_bundle_context_t *ctx) {
+static celix_status_t activator_start(struct phase3_activator_struct *act, celix_bundle_context_t *ctx) {
 	celix_status_t status = CELIX_SUCCESS;
 	printf("phase3: start\n");
 	act->phase3Cmp = phase3_create();
@@ -63,7 +57,7 @@ static celix_status_t start(struct phase3_activator_struct *act, celix_bundle_co
 
 }
 
-static celix_status_t stop(struct phase3_activator_struct *act, celix_bundle_context_t *ctx) {
+static celix_status_t activator_stop(struct phase3_activator_struct *act, celix_bundle_context_t *ctx) {
 	celix_status_t status = CELIX_SUCCESS;
 	printf("phase3: stop\n");
 	celix_dependency_manager_t *mng = celix_bundleContext_getDependencyManager(ctx);
@@ -75,4 +69,4 @@ static celix_status_t stop(struct phase3_activator_struct *act, celix_bundle_con
 }
 
 
-CELIX_GEN_BUNDLE_ACTIVATOR(struct phase3_activator_struct, start, stop);
\ No newline at end of file
+CELIX_GEN_BUNDLE_ACTIVATOR(struct phase3_activator_struct, activator_start, activator_stop);
\ No newline at end of file
diff --git a/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.cc b/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.cc
index 09781df..5a00ce7 100644
--- a/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.cc
+++ b/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.cc
@@ -20,7 +20,7 @@
 #include "Phase1Cmp.h"
 #include "Phase1Activator.h"
 #include "IPhase2.h"
-#include <celix_bundle_activator.h>
+#include <celix_api.h>
 
 using namespace celix::dm;
 
diff --git a/examples/celix-examples/dm_example_cxx/phase2/src/Phase2aActivator.cc b/examples/celix-examples/dm_example_cxx/phase2/src/Phase2aActivator.cc
index e5f3c17..276d98a 100644
--- a/examples/celix-examples/dm_example_cxx/phase2/src/Phase2aActivator.cc
+++ b/examples/celix-examples/dm_example_cxx/phase2/src/Phase2aActivator.cc
@@ -18,7 +18,7 @@
  */
 
 #include <IName.h>
-#include <celix_bundle_activator.h>
+#include <celix_api.h>
 #include "Phase2Cmp.h"
 #include "Phase2Activator.h"
 #include "log_service.h"
diff --git a/examples/celix-examples/dm_example_cxx/phase3/src/Phase3Activator.cc b/examples/celix-examples/dm_example_cxx/phase3/src/Phase3Activator.cc
index 128d476..c019ace 100644
--- a/examples/celix-examples/dm_example_cxx/phase3/src/Phase3Activator.cc
+++ b/examples/celix-examples/dm_example_cxx/phase3/src/Phase3Activator.cc
@@ -20,7 +20,7 @@
 
 #include "Phase3Cmp.h"
 #include "Phase3Activator.h"
-#include <celix_bundle_activator.h>
+#include <celix_api.h>
 
 using namespace celix::dm;
 
diff --git a/examples/celix-examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.cc b/examples/celix-examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.cc
index 494fad7..d30b295 100644
--- a/examples/celix-examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.cc
+++ b/examples/celix-examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.cc
@@ -22,7 +22,7 @@
 #include "Phase3LockingActivator.h"
 
 #include <memory>
-#include <celix_bundle_activator.h>
+#include <celix_api.h>
 
 using namespace celix::dm;
 
diff --git a/examples/celix-examples/embedding/CMakeLists.txt b/examples/celix-examples/embedding/CMakeLists.txt
index 9c96948..8d7a331 100644
--- a/examples/celix-examples/embedding/CMakeLists.txt
+++ b/examples/celix-examples/embedding/CMakeLists.txt
@@ -16,5 +16,5 @@
 # under the License.
 
 
-add_executable(embedding private/src/main)
+add_executable(embedding src/main)
 target_link_libraries(embedding Celix::framework )
\ No newline at end of file
diff --git a/examples/celix-examples/embedding/private/src/main.c b/examples/celix-examples/embedding/private/src/main.c
deleted file mode 100644
index d1ef0d6..0000000
--- a/examples/celix-examples/embedding/private/src/main.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- *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.
- */
-/*
- * main.c
- *
- *  \date       May 22, 2013
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "celix_launcher.h"
-#include "celix_errno.h"
-#include "framework.h"
-#include "bundle_context.h"
-
-struct foo {
-
-};
-
-struct fooSrv {
-	struct foo *handle;
-	celix_status_t (*foo)(struct foo *handle);
-};
-
-celix_status_t embedded_foo();
-
-int main(void) {
-
-	celix_framework_t *framework = NULL;
-
-	celix_properties_t *config = properties_create();
-	int rc = celixLauncher_launchWithProperties(config, &framework);
-
-	if (rc == 0) {
-		celix_bundle_t *fwBundle = NULL;
-		if(framework_getFrameworkBundle(framework, &fwBundle) == CELIX_SUCCESS){
-
-			if(bundle_start(fwBundle) == CELIX_SUCCESS){
-
-				celix_bundle_context_t *context = NULL;
-				bundle_getContext(fwBundle, &context);
-
-				struct foo *f = calloc(1, sizeof(*f));
-				struct fooSrv *fs = calloc(1, sizeof(*fs));
-
-				fs->handle = f;
-				fs->foo = embedded_foo;
-
-				service_registration_pt reg = NULL;
-
-				if(bundleContext_registerService(context, "foo", fs, NULL, &reg) == CELIX_SUCCESS){
-
-					service_reference_pt ref = NULL;
-					if(bundleContext_getServiceReference(context, "foo", &ref) == CELIX_SUCCESS){
-
-						void *fs2 = NULL;
-						bundleContext_getService(context, ref, &fs2);
-
-						((struct fooSrv*) fs2)->foo(((struct fooSrv*) fs2)->handle);
-
-						bundleContext_ungetService(context, ref, NULL);
-						bundleContext_ungetServiceReference(context, ref);
-						serviceRegistration_unregister(reg);
-					}
-				}
-
-				free(f);
-				free(fs);
-			}
-		}
-		celixLauncher_destroy(framework);
-	}
-
-	return rc;
-
-}
-
-celix_status_t embedded_foo() {
-	printf("foo\n");
-	return CELIX_SUCCESS;
-}
-
diff --git a/examples/celix-examples/embedding/src/main.c b/examples/celix-examples/embedding/src/main.c
new file mode 100644
index 0000000..933469c
--- /dev/null
+++ b/examples/celix-examples/embedding/src/main.c
@@ -0,0 +1,72 @@
+/**
+ *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.
+ */
+
+#include <stdlib.h>
+
+#include <celix_api.h>
+
+typedef struct foo {
+    int val;
+} foo_t;
+
+#define FOO_SERVICE_NAME "foo_service"
+typedef struct foo_service {
+	void *handle;
+	void (*foo)(void *handle);
+} foo_service_t;
+
+static void embedded_foo(void *handle) {
+    foo_t *foo = handle;
+    printf("foo with val %i\n", foo->val);
+}
+
+static void use_foo_service(void *callbackHandle __attribute__((unused)), void *voidSvc) {
+    foo_service_t *svc = voidSvc;
+    svc->foo(svc->handle);
+}
+
+int main(void) {
+
+	celix_framework_t *framework = NULL;
+	celix_properties_t *config = properties_create();
+	int rc = celixLauncher_launchWithProperties(config, &framework);
+
+	if (rc == 0) {
+		celix_bundle_context_t *ctx = celix_framework_getFrameworkContext(framework);
+
+        foo_t *foo = calloc(1, sizeof(*foo));
+        foo->val = 42;
+		foo_service_t *svc = calloc(1, sizeof(*svc));
+
+		svc->handle = foo;
+		svc->foo = embedded_foo;
+
+		long svcId = celix_bundleContext_registerService(ctx, svc, FOO_SERVICE_NAME, NULL);
+		celix_bundleContext_useService(ctx, FOO_SERVICE_NAME, NULL, use_foo_service);
+
+        celix_bundleContext_unregisterService(ctx, svcId);
+        free(svc);
+        free(foo);
+
+		celixLauncher_destroy(framework);
+	}
+
+	return rc;
+}
+
diff --git a/examples/celix-examples/hello_world/CMakeLists.txt b/examples/celix-examples/export_import/CMakeLists.txt
similarity index 94%
rename from examples/celix-examples/hello_world/CMakeLists.txt
rename to examples/celix-examples/export_import/CMakeLists.txt
index 130cef0..2b95c98 100644
--- a/examples/celix-examples/hello_world/CMakeLists.txt
+++ b/examples/celix-examples/export_import/CMakeLists.txt
@@ -18,9 +18,6 @@
 if(NOT APPLE)
 #Importing and exporting libraries not (yet) work under OSX.
 
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("public/include")
-
 add_library(hello_testlib SHARED
     private/src/test
 )
diff --git a/examples/celix-examples/hello_world_test/public/include/test.h b/examples/celix-examples/export_import/include/test.h
similarity index 100%
rename from examples/celix-examples/hello_world_test/public/include/test.h
rename to examples/celix-examples/export_import/include/test.h
diff --git a/examples/celix-examples/hello_world/public/include/test2.h b/examples/celix-examples/export_import/include/test2.h
similarity index 100%
rename from examples/celix-examples/hello_world/public/include/test2.h
rename to examples/celix-examples/export_import/include/test2.h
diff --git a/examples/celix-examples/hello_world/private/src/activator.c b/examples/celix-examples/export_import/src/activator.c
similarity index 100%
rename from examples/celix-examples/hello_world/private/src/activator.c
rename to examples/celix-examples/export_import/src/activator.c
diff --git a/examples/celix-examples/hello_world_test/private/src/test.c b/examples/celix-examples/export_import/src/test.c
similarity index 100%
rename from examples/celix-examples/hello_world_test/private/src/test.c
rename to examples/celix-examples/export_import/src/test.c
diff --git a/examples/celix-examples/hello_world/private/src/test2.c b/examples/celix-examples/export_import/src/test2.c
similarity index 100%
rename from examples/celix-examples/hello_world/private/src/test2.c
rename to examples/celix-examples/export_import/src/test2.c
diff --git a/examples/celix-examples/bundle_example_c/CMakeLists.txt b/examples/celix-examples/hello_world_c/CMakeLists.txt
similarity index 89%
rename from examples/celix-examples/bundle_example_c/CMakeLists.txt
rename to examples/celix-examples/hello_world_c/CMakeLists.txt
index aabf370..10dfaca 100644
--- a/examples/celix-examples/bundle_example_c/CMakeLists.txt
+++ b/examples/celix-examples/hello_world_c/CMakeLists.txt
@@ -15,14 +15,14 @@
 # specific language governing permissions and limitations
 # under the License.
 
-add_celix_bundle(bundle_example_c
+add_celix_bundle(hello_world_c
     VERSION 1.0.0
     SOURCES src/bundle_activator.c
 )
 
-add_celix_container(bundle_example_c_container
+add_celix_container(hello_world_c_container
     BUNDLES
         Celix::shell
         Celix::shell_tui
-        bundle_example_c
+        hello_world_c
 )
\ No newline at end of file
diff --git a/examples/celix-examples/bundle_example_c/src/bundle_activator.c b/examples/celix-examples/hello_world_c/src/bundle_activator.c
similarity index 94%
rename from examples/celix-examples/bundle_example_c/src/bundle_activator.c
rename to examples/celix-examples/hello_world_c/src/bundle_activator.c
index 7b9d0d0..8202a75 100644
--- a/examples/celix-examples/bundle_example_c/src/bundle_activator.c
+++ b/examples/celix-examples/hello_world_c/src/bundle_activator.c
@@ -18,8 +18,7 @@
  */
 
 
-#include "celix_bundle_activator.h"
-#include "celix_bundle.h"
+#include <celix_api.h>
 
 typedef struct activator_data {
     /*intentional empty*/
diff --git a/examples/celix-examples/best_practice_example_c/foo1/CMakeLists.txt b/examples/celix-examples/hello_world_cxx/CMakeLists.txt
similarity index 79%
rename from examples/celix-examples/best_practice_example_c/foo1/CMakeLists.txt
rename to examples/celix-examples/hello_world_cxx/CMakeLists.txt
index b3cdb53..4a91d26 100644
--- a/examples/celix-examples/best_practice_example_c/foo1/CMakeLists.txt
+++ b/examples/celix-examples/hello_world_cxx/CMakeLists.txt
@@ -5,9 +5,9 @@
 # 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
@@ -15,14 +15,14 @@
 # specific language governing permissions and limitations
 # under the License.
 
-include_directories(
-        private/include
+add_celix_bundle(hello_world_cxx
+    VERSION 1.0.0
+    SOURCES src/BundleActivator.cc
 )
 
-add_celix_bundle(foo1
-    SYMBOLIC_NAME foo1
-    VERSION 1.0.0
-    SOURCES
-        private/src/foo1_activator
-        private/src/foo1.c
+add_celix_container(hello_world_cxx_container
+    BUNDLES
+        Celix::shell
+        Celix::shell_tui
+        hello_world_cxx
 )
\ No newline at end of file
diff --git a/examples/celix-examples/best_practice_example_c/bar/private/include/bar.h b/examples/celix-examples/hello_world_cxx/src/BundleActivator.cc
similarity index 51%
rename from examples/celix-examples/best_practice_example_c/bar/private/include/bar.h
rename to examples/celix-examples/hello_world_cxx/src/BundleActivator.cc
index 5e1da8b..f8b2c1c 100644
--- a/examples/celix-examples/best_practice_example_c/bar/private/include/bar.h
+++ b/examples/celix-examples/hello_world_cxx/src/BundleActivator.cc
@@ -17,16 +17,29 @@
  *under the License.
  */
 
-#ifndef BAR_H_
-#define BAR_H_
+#include <memory>
+#include <iostream>
 
-#include "example.h"
+#include <celix_api.h>
 
-typedef struct bar_struct bar_t;
+namespace /*anon*/ {
 
-bar_t* bar_create(void);
-void bar_destroy(bar_t *self);
+    class BundleActivator {
+    public:
+        BundleActivator(std::shared_ptr<celix::dm::DependencyManager> _mng) : mng{_mng} {
+            celix_bundle_context_t *ctx = mng->bundleContext();
+            celix_bundle_t *bnd = celix_bundleContext_getBundle(ctx);
+            bndId = celix_bundle_getId(bnd);
+            std::cout << "Hello world from C++ bundle with id " << bndId << std::endl;
+        }
+        ~BundleActivator() {
+            std::cout << "Goodbye world from C++ bundle with id " << bndId << std::endl;
+        }
+    private:
+        std::shared_ptr<celix::dm::DependencyManager> mng;
+        long bndId;
+    };
 
-int bar_method(bar_t *self, int arg1, double arg2, double *out);
+}
 
-#endif //BAR_H_
+CELIX_GEN_CXX_BUNDLE_ACTIVATOR(BundleActivator)
\ No newline at end of file
diff --git a/examples/celix-examples/hello_world_test/CMakeLists.txt b/examples/celix-examples/hello_world_test/CMakeLists.txt
deleted file mode 100644
index 41045b2..0000000
--- a/examples/celix-examples/hello_world_test/CMakeLists.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-# 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.
-
-#############################################################################
-## NOTE Examples of using add_celix_bundle and add_celix_container and assorted commands ##
-#############################################################################
-
-add_celix_bundle(hellotest1
-    VERSION "1.2"
-    SOURCES
-        private/src/activator
-)
-
-target_include_directories(hellotest1 PRIVATE
-        ${PROJECT_SOURCE_DIR}/utils/public/include
-        public/include
-)
-
-
-celix_bundle_headers(hellotest1
-    "X-WebContent: web"
-    "X-MediaType: application/json"
-)
-
-add_library(tlib SHARED
-    private/src/test
-)
-set_library_version(tlib "4.3.2") # sets target propery VERSION to 4.3.2 and SOVERSION to 4
-
-#celix_bundle_private_libs(hellotest1
-#    #/usr/local/lib/libjansson.4.dylib
-#    /usr/lib64/libjansson.so.4
-#)
-celix_bundle_private_libs(hellotest1
-    tlib
-    #/usr/lib/libcurl.4.dylib 
-    #    /usr/lib64/libcurl.so.4
-)
-
-
-add_celix_container(hello_test_deploy
-    BUNDLES hellotest1 hellotest2 #NOTE hellotest2 is still a unknown target
-    PROPERTIES 
-        "Test=true"
-)
-
-#add_celix_container(hello_test_deploy_fail
-#    BUNDLES nonexisting
-#)
-
-#NOTE: Gives error:
-#Error evaluating generator expression:
-#
-#    $<TARGET_PROPERTY:nonexisting,BUNDLE_FILE>
-#
-#  Target "nonexisting" not found.
-
-
-
-add_library(hello2act SHARED
-    private/src/activator
-)
-set_library_version(hello2act "3.2.4") #sets VERSION prop to 3.2.4 and SOVERSION to 3
-target_link_libraries(hello2act PRIVATE Celix::framework )
-add_celix_bundle(hellotest2
-    VERSION "1.0.0" #can be the same as activator lib, but does not have to be
-    ACTIVATOR hello2act
-)
-
-#add_celix_bundle(hellotest3
-#    VERSION "2.1.2"
-    #ACTIVATOR /usr/local/lib/libjansson.4.dylib
-    #ACTIVATOR /usr/lib64/libjansson.so.4
-    #)
-
-
diff --git a/examples/celix-examples/hello_world_test/private/src/activator.c b/examples/celix-examples/hello_world_test/private/src/activator.c
deleted file mode 100644
index 8ec3546..0000000
--- a/examples/celix-examples/hello_world_test/private/src/activator.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- *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.
- */
-/*
- * activator.c
- *
- *  \date       Aug 20, 2010
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "bundle_activator.h"
-
-
-struct userData {
-	char * word;
-};
-
-celix_status_t bundleActivator_create(celix_bundle_context_t __attribute__((unused)) *context, void **userData) {
-	celix_status_t status = CELIX_SUCCESS;
-    *userData = malloc(sizeof(struct userData));
-    if (*userData != NULL) {
-		((struct userData *)(*userData))->word = "Import";
-	} else {
-		status = CELIX_START_ERROR;
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, celix_bundle_context_t __attribute__((unused)) *context) {
-	struct userData * data = (struct userData *) userData;
-	printf("Hello %s\n", data->word);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t __attribute__((unused)) *context) {
-	struct userData * data = (struct userData *) userData;
-	printf("Goodbye %s\n", data->word);
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, celix_bundle_context_t __attribute__((unused)) *context) {
-    free(userData);
-	return CELIX_SUCCESS;
-}
diff --git a/examples/celix-examples/log_service_example/src/activator.c b/examples/celix-examples/log_service_example/src/activator.c
index ac7e707..b684a5f 100644
--- a/examples/celix-examples/log_service_example/src/activator.c
+++ b/examples/celix-examples/log_service_example/src/activator.c
@@ -16,70 +16,58 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/*
- * activator.c
- *
- *  \date       Sep 11, 2017
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
-#include "bundle_activator.h"
+
+#include <celix_api.h>
 #include "log_helper.h"
 
-struct userData {
+typedef struct user_data {
 	pthread_t logger_thread;
+	pthread_mutex_t lock;
 	bool running;
 	log_helper_pt log_helper;
-};
+} user_data_t;
 
 static void *loggerThread(void *userData);
 
-celix_status_t bundleActivator_create(celix_bundle_context_t *context, void **userData) {
-	celix_status_t status = CELIX_SUCCESS;
-    *userData = calloc(1, sizeof(struct userData));
-    if (*userData != NULL) {
-        struct userData * data = (struct userData *) *userData;
-        status = logHelper_create(context, &data->log_helper);
-	} else {
-		status = CELIX_START_ERROR;
+celix_status_t activator_start(user_data_t *data, celix_bundle_context_t *ctx) {
+	celix_status_t status = logHelper_create(ctx, &data->log_helper);
+	if (status == CELIX_SUCCESS) {
+		logHelper_start(data->log_helper);
+		data->running = true;
+		pthread_mutex_init(&data->lock, NULL);
+		pthread_create(&data->logger_thread, NULL, loggerThread, data);
 	}
 	return status;
 }
 
-
-celix_status_t bundleActivator_start(void * userData, celix_bundle_context_t *context) {
-	struct userData * data = (struct userData *) userData;
-	printf("Started log example\n");
-    logHelper_start(data->log_helper);
-	data->running = true;
-    pthread_create(&data->logger_thread, NULL, loggerThread, data);
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t *context) {
-	struct userData * data = (struct userData *) userData;
-	printf("Stopping logger example\n");
-	data->running = false;
-	pthread_join(data->logger_thread, NULL);
-    logHelper_stop(data->log_helper);
+celix_status_t activator_stop(user_data_t *data, celix_bundle_context_t *ctx __attribute__((unused))) {
+    pthread_mutex_lock(&data->lock);
+    data->running = false;
+    pthread_mutex_unlock(&data->lock);
+    pthread_join(data->logger_thread, NULL);
+	logHelper_stop(data->log_helper);
+	logHelper_destroy(&data->log_helper);
 	return CELIX_SUCCESS;
 }
 
-celix_status_t bundleActivator_destroy(void * userData, celix_bundle_context_t *context) {
-    struct userData * data = (struct userData *) userData;
-    logHelper_destroy(&data->log_helper);
-    free(userData);
-	return CELIX_SUCCESS;
-}
 
 static void *loggerThread(void *userData) {
-    struct userData * data = (struct userData *) userData;
-    while (data->running) {
-        logHelper_log(data->log_helper, OSGI_LOGSERVICE_INFO, "My log message");
-        sleep(1);
-    }
-    return NULL;
+	user_data_t *data = userData;
+
+    bool running = true;
+	while (running) {
+		logHelper_log(data->log_helper, OSGI_LOGSERVICE_INFO, "My log message");
+		sleep(1);
+        pthread_mutex_lock(&data->lock);
+        running = data->running;
+        pthread_mutex_unlock(&data->lock);
+	}
+	return NULL;
 }
+
+CELIX_GEN_BUNDLE_ACTIVATOR(user_data_t, activator_start, activator_stop)
+
diff --git a/examples/celix-examples/readme.md b/examples/celix-examples/readme.md
new file mode 100644
index 0000000..7d02932
--- /dev/null
+++ b/examples/celix-examples/readme.md
@@ -0,0 +1,3 @@
+# Celix Example
+
+TODO document the examples
\ No newline at end of file
diff --git a/examples/celix-examples/services_example_c/src/dynamic_consumer_example.c b/examples/celix-examples/services_example_c/src/dynamic_consumer_example.c
index 673a84a..a666928 100644
--- a/examples/celix-examples/services_example_c/src/dynamic_consumer_example.c
+++ b/examples/celix-examples/services_example_c/src/dynamic_consumer_example.c
@@ -24,7 +24,7 @@
 #include <constants.h>
 
 #include "example_calc.h"
-#include "celix_bundle_activator.h"
+#include <celix_api.h>
 
 typedef struct activator_data {
     celix_bundle_context_t *ctx;
diff --git a/examples/celix-examples/services_example_c/src/dynamic_provider_example.c b/examples/celix-examples/services_example_c/src/dynamic_provider_example.c
index 1c3a289..3f0a2a5 100644
--- a/examples/celix-examples/services_example_c/src/dynamic_provider_example.c
+++ b/examples/celix-examples/services_example_c/src/dynamic_provider_example.c
@@ -22,8 +22,8 @@
 #include <stdlib.h>
 
 #include "example_calc.h"
-#include "celix_bundle_activator.h"
-#include "constants.h"
+#include <celix_api.h>
+
 
 typedef struct activator_data {
     long svcIds[100];
diff --git a/examples/celix-examples/services_example_c/src/simple_consumer_example.c b/examples/celix-examples/services_example_c/src/simple_consumer_example.c
index e3b1789..db1a4aa 100644
--- a/examples/celix-examples/services_example_c/src/simple_consumer_example.c
+++ b/examples/celix-examples/services_example_c/src/simple_consumer_example.c
@@ -21,10 +21,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <constants.h>
+
+#include <celix_api.h>
 
 #include "example_calc.h"
-#include "celix_bundle_activator.h"
+
 
 typedef struct activator_data {
     celix_bundle_context_t *ctx;
diff --git a/examples/celix-examples/services_example_c/src/simple_provider_example.c b/examples/celix-examples/services_example_c/src/simple_provider_example.c
index d0ebc1d..769867f 100644
--- a/examples/celix-examples/services_example_c/src/simple_provider_example.c
+++ b/examples/celix-examples/services_example_c/src/simple_provider_example.c
@@ -21,8 +21,7 @@
 #include <stdlib.h>
 
 #include "example_calc.h"
-#include "celix_bundle_activator.h"
-#include "constants.h"
+#include <celix_api.h>
 
 typedef struct activator_data {
     example_calc_t svc;
diff --git a/examples/celix-examples/services_example_cxx/bar/src/BarActivator.cc b/examples/celix-examples/services_example_cxx/bar/src/BarActivator.cc
index 91b1a5d..19bc095 100644
--- a/examples/celix-examples/services_example_cxx/bar/src/BarActivator.cc
+++ b/examples/celix-examples/services_example_cxx/bar/src/BarActivator.cc
@@ -17,9 +17,10 @@
  * under the License.
  */
 
+#include <celix_api.h>
+
 #include "Bar.h"
 #include "BarActivator.h"
-#include <celix_bundle_activator.h>
 
 using namespace celix::dm;
 
diff --git a/examples/celix-examples/services_example_cxx/baz/src/BazActivator.cc b/examples/celix-examples/services_example_cxx/baz/src/BazActivator.cc
index 2bd28a3..d1dca40 100644
--- a/examples/celix-examples/services_example_cxx/baz/src/BazActivator.cc
+++ b/examples/celix-examples/services_example_cxx/baz/src/BazActivator.cc
@@ -19,7 +19,7 @@
 
 #include "Baz.h"
 #include "BazActivator.h"
-#include <celix_bundle_activator.h>
+#include <celix_api.h>
 
 using namespace celix::dm;
 
diff --git a/examples/celix-examples/services_example_cxx/foo/src/FooActivator.cc b/examples/celix-examples/services_example_cxx/foo/src/FooActivator.cc
index 03ddd4a..27b6f45 100644
--- a/examples/celix-examples/services_example_cxx/foo/src/FooActivator.cc
+++ b/examples/celix-examples/services_example_cxx/foo/src/FooActivator.cc
@@ -19,7 +19,7 @@
 
 #include "Foo.h"
 #include "FooActivator.h"
-#include <celix_bundle_activator.h>
+#include <celix_api.h>
 
 using namespace celix::dm;
 
diff --git a/libs/framework/include/celix/dm/Component_Impl.h b/libs/framework/include/celix/dm/Component_Impl.h
index b855180..a7e74c5 100644
--- a/libs/framework/include/celix/dm/Component_Impl.h
+++ b/libs/framework/include/celix/dm/Component_Impl.h
@@ -101,15 +101,11 @@ Component<T>& Component<T>::removeCInterface(const I* svc){
 template<class T>
 template<class I>
 ServiceDependency<T,I>& Component<T>::createServiceDependency(const std::string name) {
-#ifdef __EXCEPTIONS
-    auto dep = std::shared_ptr<ServiceDependency<T,I>> {new ServiceDependency<T,I>(name)};
-#else
     static ServiceDependency<T,I> invalidDep{std::string{}, false};
-    auto dep = std::shared_ptr<ServiceDependency<T,I>> {new(std::nothrow) ServiceDependency<T,I>(name)};
+    auto dep = std::shared_ptr<ServiceDependency<T,I>> {new ServiceDependency<T,I>(name)};
     if (dep == nullptr) {
         return invalidDep;
     }
-#endif
     this->dependencies.push_back(dep);
     celix_dmComponent_addServiceDependency(cComponent(), dep->cServiceDependency());
     dep->setComponentInstance(&getInstance());
@@ -127,15 +123,11 @@ Component<T>& Component<T>::remove(ServiceDependency<T,I>& dep) {
 template<class T>
 template<typename I>
 CServiceDependency<T,I>& Component<T>::createCServiceDependency(const std::string name) {
-#ifdef __EXCEPTIONS
-    auto dep = std::shared_ptr<CServiceDependency<T,I>> {new CServiceDependency<T,I>(name)};
-#else
     static CServiceDependency<T,I> invalidDep{std::string{}, false};
-    auto dep = std::shared_ptr<CServiceDependency<T,I>> {new(std::nothrow) CServiceDependency<T,I>(name)};
+    auto dep = std::shared_ptr<CServiceDependency<T,I>> {new CServiceDependency<T,I>(name)};
     if (dep == nullptr) {
         return invalidDep;
     }
-#endif
     this->dependencies.push_back(dep);
     celix_dmComponent_addServiceDependency(cComponent(), dep->cServiceDependency());
     dep->setComponentInstance(&getInstance());
@@ -158,15 +150,11 @@ Component<T>* Component<T>::create(celix_bundle_context_t *context) {
 
 template<class T>
 Component<T>* Component<T>::create(celix_bundle_context_t *context, std::string name) {
-#ifdef __EXCEPTIONS
-    Component<T>* cmp = new Component<T>{context, name};
-#else
     static Component<T> invalid{nullptr, std::string{}};
-    Component<T>* cmp = new(std::nothrow) Component<T>(context, name);
+    Component<T>* cmp = new Component<T>(context, name);
     if (cmp == nullptr) {
         cmp = &invalid;
     }
-#endif
     return cmp;
 }
 
@@ -183,12 +171,7 @@ T& Component<T>::getInstance() {
         return *this->sharedInstance;
     } else {
         if (this->instance.get() == nullptr) {
-#ifdef __EXCEPTIONS
             this->instance = std::unique_ptr<T> {new T()};
-#else
-            this->instance = std::unique_ptr<T> {new(std::nothrow) T()};
-
-#endif
         }
         return *this->instance;
     }
diff --git a/libs/framework/include/celix_api.h b/libs/framework/include/celix_api.h
index bb1fd01..1b5d31d 100644
--- a/libs/framework/include/celix_api.h
+++ b/libs/framework/include/celix_api.h
@@ -44,4 +44,9 @@
 
 #include "celix_bundle_activator.h"
 
+#ifdef __cplusplus
+#include "celix/dm/DependencyManager.h"
+#endif
+
+
 #endif //CELIX_CELIX_API_H_