You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by ab...@apache.org on 2014/05/19 11:44:36 UTC
svn commit: r1595802 - in /incubator/celix/trunk: ./ libraries/ libraries/a/
libraries/b/
Author: abroekhuis
Date: Mon May 19 09:44:35 2014
New Revision: 1595802
URL: http://svn.apache.org/r1595802
Log:
CELIX-111, CELIX-112: Added example for multiple library support testing
Added:
incubator/celix/trunk/libraries/
incubator/celix/trunk/libraries/CMakeLists.txt
incubator/celix/trunk/libraries/a/
incubator/celix/trunk/libraries/a/CMakeLists.txt
incubator/celix/trunk/libraries/a/a.c
incubator/celix/trunk/libraries/a/a.h
incubator/celix/trunk/libraries/b/
incubator/celix/trunk/libraries/b/CMakeLists.txt
incubator/celix/trunk/libraries/b/b.c
incubator/celix/trunk/libraries/b/b.h
incubator/celix/trunk/libraries/main.c
Modified:
incubator/celix/trunk/CMakeLists.txt
Modified: incubator/celix/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/CMakeLists.txt?rev=1595802&r1=1595801&r2=1595802&view=diff
==============================================================================
--- incubator/celix/trunk/CMakeLists.txt (original)
+++ incubator/celix/trunk/CMakeLists.txt Mon May 19 09:44:35 2014
@@ -24,6 +24,9 @@ cmake_policy(SET CMP0012 NEW)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
+set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+set(CMAKE_INSTALL_NAME_DIR "@rpath")
+
SET(CMAKE_BUILD_TYPE "Debug")
IF(UNIX)
SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 ${CMAKE_C_FLAGS}")
@@ -67,4 +70,6 @@ add_subdirectory(launcher)
add_subdirectory(framework)
add_subdirectory(utils)
+add_subdirectory(libraries)
+
deploy_targets()
Added: incubator/celix/trunk/libraries/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/libraries/CMakeLists.txt?rev=1595802&view=auto
==============================================================================
--- incubator/celix/trunk/libraries/CMakeLists.txt (added)
+++ incubator/celix/trunk/libraries/CMakeLists.txt Mon May 19 09:44:35 2014
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 2.6)
+
+add_subDirectory(a)
+add_subDirectory(b)
+
+add_executable(main main.c)
\ No newline at end of file
Added: incubator/celix/trunk/libraries/a/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/libraries/a/CMakeLists.txt?rev=1595802&view=auto
==============================================================================
--- incubator/celix/trunk/libraries/a/CMakeLists.txt (added)
+++ incubator/celix/trunk/libraries/a/CMakeLists.txt Mon May 19 09:44:35 2014
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.6)
+
+add_library(a SHARED a.c)
Added: incubator/celix/trunk/libraries/a/a.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/libraries/a/a.c?rev=1595802&view=auto
==============================================================================
--- incubator/celix/trunk/libraries/a/a.c (added)
+++ incubator/celix/trunk/libraries/a/a.c Mon May 19 09:44:35 2014
@@ -0,0 +1,32 @@
+/**
+ *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.
+ */
+/*
+ * a.c
+ *
+ * \date 31 Oct 2013
+ * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdio.h>
+
+#include "a.h"
+
+void sayHi(char *hi) {
+ printf("Hi: %s\n", hi);
+}
Added: incubator/celix/trunk/libraries/a/a.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/libraries/a/a.h?rev=1595802&view=auto
==============================================================================
--- incubator/celix/trunk/libraries/a/a.h (added)
+++ incubator/celix/trunk/libraries/a/a.h Mon May 19 09:44:35 2014
@@ -0,0 +1,34 @@
+/**
+ *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.
+ */
+/*
+ * a.h
+ *
+ * \date 31 Oct 2013
+ * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef A_H_
+#define A_H_
+
+
+void sayHi(char *hi);
+
+
+#endif /* A_H_ */
Added: incubator/celix/trunk/libraries/b/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/libraries/b/CMakeLists.txt?rev=1595802&view=auto
==============================================================================
--- incubator/celix/trunk/libraries/b/CMakeLists.txt (added)
+++ incubator/celix/trunk/libraries/b/CMakeLists.txt Mon May 19 09:44:35 2014
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 2.6)
+
+add_library(b SHARED b.c)
+
+target_link_libraries(b a)
+include_directories("${PROJECT_SOURCE_DIR}/libraries/a")
\ No newline at end of file
Added: incubator/celix/trunk/libraries/b/b.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/libraries/b/b.c?rev=1595802&view=auto
==============================================================================
--- incubator/celix/trunk/libraries/b/b.c (added)
+++ incubator/celix/trunk/libraries/b/b.c Mon May 19 09:44:35 2014
@@ -0,0 +1,33 @@
+/**
+ *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.
+ */
+/*
+ * b.c
+ *
+ * \date 31 Oct 2013
+ * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#include <stdio.h>
+
+#include "b.h"
+
+void sayBye(char *bye) {
+ printf("Bye: %s\n", bye);
+}
Added: incubator/celix/trunk/libraries/b/b.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/libraries/b/b.h?rev=1595802&view=auto
==============================================================================
--- incubator/celix/trunk/libraries/b/b.h (added)
+++ incubator/celix/trunk/libraries/b/b.h Mon May 19 09:44:35 2014
@@ -0,0 +1,34 @@
+/**
+ *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.
+ */
+/*
+ * b.h
+ *
+ * \date 31 Oct 2013
+ * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef B_H_
+#define B_H_
+
+
+void sayBye(char *bye);
+
+
+#endif /* B_H_ */
Added: incubator/celix/trunk/libraries/main.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/libraries/main.c?rev=1595802&view=auto
==============================================================================
--- incubator/celix/trunk/libraries/main.c (added)
+++ incubator/celix/trunk/libraries/main.c Mon May 19 09:44:35 2014
@@ -0,0 +1,55 @@
+/**
+ *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 31 Oct 2013
+ * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <stdio.h>
+#include <dlfcn.h>
+
+typedef void (*sayHi)(char *hi);
+
+int main() {
+ void * handle = NULL;
+ handle = dlopen("./libb.dylib", RTLD_GLOBAL|RTLD_LAZY);
+ if (handle == NULL) {
+ printf("Null %s\n", dlerror());
+ } else {
+ printf("Open\n");
+ }
+ handle = dlopen("./liba.dylib", RTLD_LOCAL);
+ if (handle == NULL) {
+ printf("Null %s\n", dlerror());
+ } else {
+ sayHi fct;
+ fct = dlsym(handle, "sayHi");
+ if (fct == NULL) {
+ printf("Null %s\n", dlerror());
+ } else {
+ fct("bla");
+ }
+
+ }
+
+ return 0;
+}