diff Core/OrthancFramework.h @ 3996:c2b9a7a1c74a

ORTHANC_FRAMEWORK_BUILDING_PLUGIN
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Jun 2020 18:26:01 +0200
parents f9863630ec7f
children 44e2a8e0b6ae
line wrap: on
line diff
--- a/Core/OrthancFramework.h	Fri Jun 05 18:08:17 2020 +0200
+++ b/Core/OrthancFramework.h	Fri Jun 05 18:26:01 2020 +0200
@@ -41,23 +41,33 @@
 #ifndef __ORTHANC_FRAMEWORK_H
 #define __ORTHANC_FRAMEWORK_H
 
+#if !defined(ORTHANC_FRAMEWORK_BUILDING_PLUGIN)
+#  error Macro ORTHANC_FRAMEWORK_BUILDING_PLUGIN must be defined
+#endif
+
 /**
  * It is implied that if this file is used, we're building the Orthanc
- * framework (not using it): We don't use the common "BUILDING_DLL"
+ * framework (not using it as a shared library): We don't use the
+ * common "BUILDING_DLL"
  * construction. https://gcc.gnu.org/wiki/Visibility
  **/
-#if defined(_WIN32) || defined (__CYGWIN__)
-#  define ORTHANC_PUBLIC __declspec(dllexport)
-#  define ORTHANC_LOCAL
+#if ORTHANC_FRAMEWORK_BUILDING_PLUGIN == 0
+#  if defined(_WIN32) || defined (__CYGWIN__)
+#    define ORTHANC_PUBLIC __declspec(dllexport)
+#    define ORTHANC_LOCAL
+#  else
+#    if __GNUC__ >= 4
+#      define ORTHANC_PUBLIC __attribute__((visibility ("default")))
+#      define ORTHANC_LOCAL  __attribute__((visibility ("hidden")))
+#    else
+#      define ORTHANC_PUBLIC
+#      define ORTHANC_LOCAL
+#      pragma warning Unknown dynamic link import/export semantics
+#    endif
+#  endif
 #else
-#  if __GNUC__ >= 4
-#    define ORTHANC_PUBLIC __attribute__((visibility ("default")))
-#    define ORTHANC_LOCAL  __attribute__((visibility ("hidden")))
-#  else
-#    define ORTHANC_PUBLIC
-#    define ORTHANC_LOCAL
-#    pragma warning Unknown dynamic link import/export semantics
-#  endif
+#  define ORTHANC_PUBLIC
+#  define ORTHANC_LOCAL
 #endif
 
 #endif /* __ORTHANC_FRAMEWORK_H */