]> rtime.felk.cvut.cz Git - ulut.git/commitdiff
Unified DLL/shared library export import symbol visibility specification.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Tue, 6 Apr 2010 19:04:32 +0000 (21:04 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Tue, 6 Apr 2010 19:04:32 +0000 (21:04 +0200)
This is more or less how Wikipedia example suggests the macros
names and use.

To change default symbols visibility next options should be
specified in config.omk file.

CFLAGS += -fvisibility=hidden
LDLAGS += -fvisibility=hidden

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
ulut/ul_utexport.h

index 4abe37623b30b5ee37fdb69235ac9e4a4d746253..1bed464a11f711901cc4761e9cac613b9c09f87e 100644 (file)
@@ -1,20 +1,23 @@
 /* Shared library support */
 #ifndef UL_EXPORT
   #if defined(_WIN32)&&defined(_MSC_VER)
-    #define UL_IMPORT __declspec(dllimport)
-    #define UL_EXPORT __declspec(dllexport)
-    #define UL_DLLLOCAL
-    #define UL_DLLPUBLIC
+    #define UL_DLL_IMPORT __declspec(dllimport)
+    #define UL_DLL_EXPORT __declspec(dllexport)
+    #define UL_DLL_LOCAL
+    #define UL_DLL_PUBLIC
   #else
-    #define UL_IMPORT
+    #if (__GNUC__ >= 4) && !defined(GCC_HASCLASSVISIBILITY)
+       #define GCC_HASCLASSVISIBILITY
+    #endif
+    #define UL_DLL_IMPORT
     #ifdef GCC_HASCLASSVISIBILITY
-      #define UL_EXPORT __attribute__ ((visibility("default")))
-      #define UL_DLLLOCAL __attribute__ ((visibility("hidden")))
-      #define UL_DLLPUBLIC __attribute__ ((visibility("default")))
+      #define UL_DLL_EXPORT __attribute__ ((visibility("default")))
+      #define UL_DLL_LOCAL __attribute__ ((visibility("hidden")))
+      #define UL_DLL_PUBLIC __attribute__ ((visibility("default")))
     #else
-      #define UL_EXPORT
-      #define UL_DLLLOCAL
-      #define UL_DLLPUBLIC
+      #define UL_DLL_EXPORT
+      #define UL_DLL_LOCAL
+      #define UL_DLL_PUBLIC
     #endif
   #endif
 #endif /* UL_EXPORT */