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 2013/11/19 08:14:53 UTC

svn commit: r1543323 - in /incubator/celix/trunk: ./ device_access/device_access/private/src/ framework/public/include/

Author: abroekhuis
Date: Tue Nov 19 07:14:53 2013
New Revision: 1543323

URL: http://svn.apache.org/r1543323
Log:
Setup visibility control for GCC

Visibility control was already in place for Visual Studio. Now this is also used for GCC.

Modified:
    incubator/celix/trunk/CMakeLists.txt
    incubator/celix/trunk/device_access/device_access/private/src/device_manager.c
    incubator/celix/trunk/framework/public/include/bundle_context.h
    incubator/celix/trunk/framework/public/include/filter.h
    incubator/celix/trunk/framework/public/include/framework_exports.h
    incubator/celix/trunk/framework/public/include/manifest.h
    incubator/celix/trunk/framework/public/include/version.h

Modified: incubator/celix/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/CMakeLists.txt?rev=1543323&r1=1543322&r2=1543323&view=diff
==============================================================================
--- incubator/celix/trunk/CMakeLists.txt (original)
+++ incubator/celix/trunk/CMakeLists.txt Tue Nov 19 07:14:53 2013
@@ -26,7 +26,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PAT
 
 SET(CMAKE_BUILD_TYPE "Debug")
 IF(UNIX)
-	SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 ${CMAKE_C_FLAGS}")
+	SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -fvisibility=hidden ${CMAKE_C_FLAGS}")
 ENDIF()
 IF(WIN32)
 	SET(CMAKE_C_FLAGS "-D_CRT_SECURE_NO_WARNINGS ${CMAKE_C_FLAGS}")

Modified: incubator/celix/trunk/device_access/device_access/private/src/device_manager.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/device_access/device_access/private/src/device_manager.c?rev=1543323&r1=1543322&r2=1543323&view=diff
==============================================================================
--- incubator/celix/trunk/device_access/device_access/private/src/device_manager.c (original)
+++ incubator/celix/trunk/device_access/device_access/private/src/device_manager.c Tue Nov 19 07:14:53 2013
@@ -439,38 +439,33 @@ celix_status_t deviceManager_getIdleDevi
 				if (substatus == CELIX_SUCCESS) {
 					substatus = module_getSymbolicName(module, &bsn);
 					if (substatus == CELIX_SUCCESS) {
-						service_registration_pt registration = NULL;
-						substatus = serviceReference_getServiceRegistration(ref, &registration);
+						printf("DEVICE_MANAGER: Check idle device: %s\n", bsn);
+						array_list_pt bundles = NULL;
+						substatus = serviceReference_getUsingBundles(ref, pool, &bundles);
 						if (substatus == CELIX_SUCCESS) {
-							service_registry_pt registry = NULL;
-							substatus = serviceRegistration_getRegistry(registration, &registry);
-							if (substatus == CELIX_SUCCESS) {
-								printf("DEVICE_MANAGER: Check idle device: %s\n", bsn);
-								array_list_pt bundles = serviceRegistry_getUsingBundles(registry, pool, ref);
-								bool inUse = false;
-								int i;
-								for (i = 0; i < arrayList_size(bundles); i++) {
-									bundle_pt bundle = arrayList_get(bundles, i);
-									bool isDriver;
-									celix_status_t sstatus = deviceManager_isDriverBundle(manager, bundle, &isDriver);
-									if (sstatus == CELIX_SUCCESS) {
-										if (isDriver) {
-											char *bsn = NULL;
-											module_pt module = NULL;
-											bundle_getCurrentModule(bundle, &module);
-											module_getSymbolicName(module, &bsn);
-
-											printf("DEVICE_MANAGER: Not idle, used by driver: %s\n", bsn);
-
-											inUse = true;
-											break;
-										}
+							bool inUse = false;
+							int i;
+							for (i = 0; i < arrayList_size(bundles); i++) {
+								bundle_pt bundle = arrayList_get(bundles, i);
+								bool isDriver;
+								celix_status_t sstatus = deviceManager_isDriverBundle(manager, bundle, &isDriver);
+								if (sstatus == CELIX_SUCCESS) {
+									if (isDriver) {
+										char *bsn = NULL;
+										module_pt module = NULL;
+										bundle_getCurrentModule(bundle, &module);
+										module_getSymbolicName(module, &bsn);
+
+										printf("DEVICE_MANAGER: Not idle, used by driver: %s\n", bsn);
+
+										inUse = true;
+										break;
 									}
 								}
+							}
 
-								if (!inUse) {
-									arrayList_add(*idleDevices, ref);
-								}
+							if (!inUse) {
+								arrayList_add(*idleDevices, ref);
 							}
 						}
 					}
@@ -497,16 +492,13 @@ celix_status_t deviceManager_getIdleDevi
 			char *bsn = NULL;
 			module_pt module = NULL;
 			bundle_pt bundle = NULL;
-			service_registration_pt registration = NULL;
-			service_registry_pt registry = NULL;
+			array_list_pt bundles = NULL;
 			substatus = serviceReference_getBundle(ref, &bundle);
 			substatus = DO_IF_SUCCESS(substatus, bundle_getCurrentModule(bundle, &module));
 			substatus = DO_IF_SUCCESS(substatus, module_getSymbolicName(module, &bsn));
-			substatus = DO_IF_SUCCESS(substatus, serviceReference_getServiceRegistration(ref, &registration));
-			substatus = DO_IF_SUCCESS(substatus, serviceRegistration_getRegistry(registration, &registry));
+			substatus = DO_IF_SUCCESS(substatus, serviceReference_getUsingBundles(ref, pool, &bundles));
 
 			if (substatus == CELIX_SUCCESS) {
-				array_list_pt bundles = serviceRegistry_getUsingBundles(registry, pool, ref);
 				printf("DEVICE_MANAGER: Check idle device: %s\n", bsn);
 				bool inUse = false;
 				int i;

Modified: incubator/celix/trunk/framework/public/include/bundle_context.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/bundle_context.h?rev=1543323&r1=1543322&r2=1543323&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/bundle_context.h (original)
+++ incubator/celix/trunk/framework/public/include/bundle_context.h Tue Nov 19 07:14:53 2013
@@ -40,8 +40,8 @@ typedef struct bundleContext *bundle_con
 #include "properties.h"
 #include "array_list.h"
 
-FRAMEWORK_EXPORT celix_status_t bundleContext_create(framework_pt framework, bundle_pt bundle, bundle_context_pt *bundle_context);
-FRAMEWORK_EXPORT celix_status_t bundleContext_destroy(bundle_context_pt context);
+celix_status_t bundleContext_create(framework_pt framework, bundle_pt bundle, bundle_context_pt *bundle_context);
+celix_status_t bundleContext_destroy(bundle_context_pt context);
 
 FRAMEWORK_EXPORT celix_status_t bundleContext_getBundle(bundle_context_pt context, bundle_pt *bundle);
 FRAMEWORK_EXPORT celix_status_t bundleContext_getFramework(bundle_context_pt context, framework_pt *framework);

Modified: incubator/celix/trunk/framework/public/include/filter.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/filter.h?rev=1543323&r1=1543322&r2=1543323&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/filter.h (original)
+++ incubator/celix/trunk/framework/public/include/filter.h Tue Nov 19 07:14:53 2013
@@ -32,14 +32,15 @@
 #include "celix_errno.h"
 #include "properties.h"
 #include "celixbool.h"
+#include "framework_exports.h"
 
 typedef struct filter * filter_pt;
 
-filter_pt filter_create(char * filterString, apr_pool_t *pool);
-void filter_destroy(filter_pt filter);
+FRAMEWORK_EXPORT filter_pt filter_create(char * filterString, apr_pool_t *pool);
+FRAMEWORK_EXPORT void filter_destroy(filter_pt filter);
 
-celix_status_t filter_match(filter_pt filter, properties_pt properties, bool *result);
+FRAMEWORK_EXPORT celix_status_t filter_match(filter_pt filter, properties_pt properties, bool *result);
 
-celix_status_t filter_getString(filter_pt filter, char **filterStr);
+FRAMEWORK_EXPORT celix_status_t filter_getString(filter_pt filter, char **filterStr);
 
 #endif /* FILTER_H_ */

Modified: incubator/celix/trunk/framework/public/include/framework_exports.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/framework_exports.h?rev=1543323&r1=1543322&r2=1543323&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/framework_exports.h (original)
+++ incubator/celix/trunk/framework/public/include/framework_exports.h Tue Nov 19 07:14:53 2013
@@ -1,46 +1,65 @@
-/**
- *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.
- */
-/*
- * exports.h
- */
-
-#ifndef FRAMEWORK_EXPORTS_H_
-#define FRAMEWORK_EXPORTS_H_
-
-/* Cmake will define celix_framework_EXPORTS on Windows when it
-configures to build a shared library. If you are going to use
-another build system on windows or create the visual studio
-projects by hand you need to define celix_framework_EXPORTS when
-building a DLL on windows.
-*/
-// We are using the Visual Studio Compiler and building Shared libraries
-
-#if defined (_WIN32)
-	#define  ACTIVATOR_EXPORT __declspec(dllexport)
-  #if defined(celix_framework_EXPORTS)
-    #define  FRAMEWORK_EXPORT __declspec(dllexport)
-  #else
-    #define  FRAMEWORK_EXPORT __declspec(dllimport)
-  #endif /* framework_EXPORTS */
-#else /* defined (_WIN32) */
-#define FRAMEWORK_EXPORT __attribute__((visibility("default")))
-#define ACTIVATOR_EXPORT __attribute__((visibility("default")))
-#endif
-
-#endif /* FRAMEWORK_EXPORTS_H_ */
+/**
+ *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.
+ */
+/*
+ * exports.h
+ */
+
+#ifndef FRAMEWORK_EXPORTS_H_
+#define FRAMEWORK_EXPORTS_H_
+
+/* Cmake will define celix_framework_EXPORTS on Windows when it
+configures to build a shared library. If you are going to use
+another build system on windows or create the visual studio
+projects by hand you need to define celix_framework_EXPORTS when
+building a DLL on windows.
+*/
+// We are using the Visual Studio Compiler and building Shared libraries
+
+#if defined _WIN32 || defined __CYGWIN__
+  #ifdef celix_framework_EXPORTS
+    #ifdef __GNUC__
+      #define FRAMEWORK_EXPORT __attribute__ ((dllexport))
+      #define ACTIVATOR_EXPORT __attribute__ ((dllexport))
+    #else
+      #define ACTIVATOR_EXPORT __declspec(dllexport)
+      #define FRAMEWORK_EXPORT __declspec(dllexport) // Note: actually gcc seems to also supports this syntax.
+    #endif
+  #else
+    #ifdef __GNUC__
+      #define ACTIVATOR_EXPORT __attribute__ ((dllexport))
+      #define FRAMEWORK_EXPORT __attribute__ ((dllimport))
+    #else
+      #define ACTIVATOR_EXPORT __declspec(dllexport)
+      #define FRAMEWORK_EXPORT __declspec(dllimport) // Note: actually gcc seems to also supports this syntax.
+    #endif
+  #endif
+  #define DLL_LOCAL
+#else
+  #if __GNUC__ >= 4
+    #define ACTIVATOR_EXPORT __attribute__ ((visibility ("default")))
+    #define FRAMEWORK_EXPORT __attribute__ ((visibility ("default")))
+    #define FRAMEWORK_LOCAL  __attribute__ ((visibility ("hidden")))
+  #else
+    #define ACTIVATOR_EXPORT
+    #define FRAMEWORK_EXPORT
+    #define FRAMEWORK_LOCAL
+  #endif
+#endif
+
+#endif /* FRAMEWORK_EXPORTS_H_ */

Modified: incubator/celix/trunk/framework/public/include/manifest.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/manifest.h?rev=1543323&r1=1543322&r2=1543323&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/manifest.h (original)
+++ incubator/celix/trunk/framework/public/include/manifest.h Tue Nov 19 07:14:53 2013
@@ -31,6 +31,7 @@
 
 #include "properties.h"
 #include "celix_errno.h"
+#include "framework_exports.h"
 
 struct manifest {
 	apr_pool_t *pool;
@@ -40,16 +41,16 @@ struct manifest {
 
 typedef struct manifest * manifest_pt;
 
-celix_status_t manifest_create(apr_pool_t *pool, manifest_pt *manifest);
-celix_status_t manifest_createFromFile(apr_pool_t *pool, char *filename, manifest_pt *manifest);
+FRAMEWORK_EXPORT celix_status_t manifest_create(apr_pool_t *pool, manifest_pt *manifest);
+FRAMEWORK_EXPORT celix_status_t manifest_createFromFile(apr_pool_t *pool, char *filename, manifest_pt *manifest);
 
-void manifest_clear(manifest_pt manifest);
-properties_pt manifest_getMainAttributes(manifest_pt manifest);
-celix_status_t manifest_getEntries(manifest_pt manifest, hash_map_pt *map);
+FRAMEWORK_EXPORT void manifest_clear(manifest_pt manifest);
+FRAMEWORK_EXPORT properties_pt manifest_getMainAttributes(manifest_pt manifest);
+FRAMEWORK_EXPORT celix_status_t manifest_getEntries(manifest_pt manifest, hash_map_pt *map);
 
-celix_status_t manifest_read(manifest_pt manifest, char *filename);
-void manifest_write(manifest_pt manifest, char * filename);
+FRAMEWORK_EXPORT celix_status_t manifest_read(manifest_pt manifest, char *filename);
+FRAMEWORK_EXPORT void manifest_write(manifest_pt manifest, char * filename);
 
-char * manifest_getValue(manifest_pt manifest, const char * name);
+FRAMEWORK_EXPORT char * manifest_getValue(manifest_pt manifest, const char * name);
 
 #endif /* MANIFEST_H_ */

Modified: incubator/celix/trunk/framework/public/include/version.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/version.h?rev=1543323&r1=1543322&r2=1543323&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/version.h (original)
+++ incubator/celix/trunk/framework/public/include/version.h Tue Nov 19 07:14:53 2013
@@ -30,6 +30,7 @@
 #include <apr_general.h>
 
 #include "celix_errno.h"
+#include "framework_exports.h"
 
 /**
  * @defgroup Version Version
@@ -59,7 +60,7 @@ typedef struct version * version_pt;
  * 		- CELIX_ILLEGAL_ARGUMENT If the numerical components are negative
  * 		  or the qualifier string is invalid.
  */
-celix_status_t version_createVersion(apr_pool_t *pool, int major, int minor, int micro, char * qualifier, version_pt *version);
+FRAMEWORK_EXPORT celix_status_t version_createVersion(apr_pool_t *pool, int major, int minor, int micro, char * qualifier, version_pt *version);
 
 /**
  * Creates a clone of <code>version</code> allocated on <code>pool</code>.
@@ -73,7 +74,7 @@ celix_status_t version_createVersion(apr
  * 		- CELIX_ILLEGAL_ARGUMENT If the numerical components are negative
  * 		  or the qualifier string is invalid.
  */
-celix_status_t version_clone(version_pt version, apr_pool_t *pool, version_pt *clone);
+FRAMEWORK_EXPORT celix_status_t version_clone(version_pt version, apr_pool_t *pool, version_pt *clone);
 
 /**
  * Creates a version identifier from the specified string.
@@ -102,7 +103,7 @@ celix_status_t version_clone(version_pt 
  * 		- CELIX_ILLEGAL_ARGUMENT If the numerical components are negative,
  * 		  	the qualifier string is invalid or <code>versionStr</code> is improperly formatted.
  */
-celix_status_t version_createVersionFromString(apr_pool_t *pool, char * versionStr, version_pt *version);
+FRAMEWORK_EXPORT celix_status_t version_createVersionFromString(apr_pool_t *pool, char * versionStr, version_pt *version);
 
 /**
  * The empty version "0.0.0".
@@ -115,12 +116,12 @@ celix_status_t version_createVersionFrom
  * 		- CELIX_ILLEGAL_ARGUMENT If the numerical components are negative,
  * 		  	the qualifier string is invalid or <code>versionStr</code> is improperly formatted.
  */
-celix_status_t version_createEmptyVersion(apr_pool_t *pool, version_pt *version);
+FRAMEWORK_EXPORT celix_status_t version_createEmptyVersion(apr_pool_t *pool, version_pt *version);
 
-celix_status_t version_getMajor(version_pt version, int *major);
-celix_status_t version_getMinor(version_pt version, int *minor);
-celix_status_t version_getMicro(version_pt version, int *micro);
-celix_status_t version_getQualifier(version_pt version, char **qualifier);
+FRAMEWORK_EXPORT celix_status_t version_getMajor(version_pt version, int *major);
+FRAMEWORK_EXPORT celix_status_t version_getMinor(version_pt version, int *minor);
+FRAMEWORK_EXPORT celix_status_t version_getMicro(version_pt version, int *micro);
+FRAMEWORK_EXPORT celix_status_t version_getQualifier(version_pt version, char **qualifier);
 
 /**
  * Compares this <code>Version</code> object to another object.
@@ -147,7 +148,7 @@ celix_status_t version_getQualifier(vers
  * @return Status code indication failure or success:
  * 		- CELIX_SUCCESS when no errors are encountered.
  */
-celix_status_t version_compareTo(version_pt version, version_pt compare, int *result);
+FRAMEWORK_EXPORT celix_status_t version_compareTo(version_pt version, version_pt compare, int *result);
 
 /**
  * Returns the string representation of <code>version</code> identifier.
@@ -164,7 +165,7 @@ celix_status_t version_compareTo(version
  * @return Status code indication failure or success:
  * 		- CELIX_SUCCESS when no errors are encountered.
  */
-celix_status_t version_toString(version_pt version, apr_pool_t *pool, char **string);
+FRAMEWORK_EXPORT celix_status_t version_toString(version_pt version, apr_pool_t *pool, char **string);
 
 /**
  * @}