From 218a15d4304fbc269b2b4e1cd61df6ff266b2ce9 Mon Sep 17 00:00:00 2001
From: Thomas Moulard <thomas.moulard@gmail.com>
Date: Tue, 2 Nov 2010 17:51:30 +0100
Subject: [PATCH] Fix visibility management for all plug-ins.

---
 CMakeLists.txt                           | 13 +++++++++++++
 cmake                                    |  2 +-
 include/dynamic-graph/contiifstream.h    | 20 ++++----------------
 include/dynamic-graph/shell-procedure.h  | 17 ++---------------
 include/dynamic-graph/tracer-real-time.h | 24 +++++-------------------
 include/dynamic-graph/tracer.h           | 22 ++++------------------
 6 files changed, 29 insertions(+), 69 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fddd0c6..b8e0b0d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,6 +34,19 @@ SET(CXX_DISABLE_WERROR True)
 
 SETUP_PROJECT()
 
+# Add configuration headers for plug-ins.
+GENERATE_CONFIGURATION_HEADER(
+  ${HEADER_DIR} config-tracer.hh DG_TRACER tracer_EXPORTS)
+GENERATE_CONFIGURATION_HEADER(
+  ${HEADER_DIR}
+  config-tracer-real-time.hh DG_TRACERREALTIME tracer_real_time_EXPORTS)
+GENERATE_CONFIGURATION_HEADER(
+  ${HEADER_DIR}
+  config-shell-procedure.hh DG_SHELLPROCEDURE shell_procedure_EXPORTS)
+GENERATE_CONFIGURATION_HEADER(
+  ${HEADER_DIR}
+  config-contiifstream.hh DG_CONTIIFSTREAM contiifstream_EXPORTS)
+
 # FIXME: to be changed into lib/dynamic-graph
 # to avoid name collision when installing dynamic-graph in /usr.
 SET(PLUGINDIR "lib/plugin")
diff --git a/cmake b/cmake
index fe203df..1d7db7d 160000
--- a/cmake
+++ b/cmake
@@ -1 +1 @@
-Subproject commit fe203dff78ea6e7db58b1d8df8152495f34cb079
+Subproject commit 1d7db7da015ea4d25d6710bad4493b35ce3b05f6
diff --git a/include/dynamic-graph/contiifstream.h b/include/dynamic-graph/contiifstream.h
index 2c298c2..4d51f86 100644
--- a/include/dynamic-graph/contiifstream.h
+++ b/include/dynamic-graph/contiifstream.h
@@ -30,33 +30,21 @@
 #include <fstream>
 #include <sstream>
 #ifndef WIN32
-#include <unistd.h>
+# include <unistd.h>
 #endif
 #include <list>
 
 #include <dynamic-graph/interpreter.h>
+#include <dynamic-graph/config-contiifstream.hh>
 #ifndef WIN32
-#include <pthread.h>
-#endif
-/* --------------------------------------------------------------------- */
-/* --- API ------------------------------------------------------------- */
-/* --------------------------------------------------------------------- */
-
-#if defined (WIN32)
-#  if defined (contiifstream_EXPORTS)
-#    define DYNAMICGRAPHCONTIIFSTREAM_EXPORT __declspec(dllexport)
-#  else
-#    define DYNAMICGRAPHCONTIIFSTREAM_EXPORT __declspec(dllimport)
-#  endif
-#else
-#  define DYNAMICGRAPHCONTIIFSTREAM_EXPORT
+# include <pthread.h>
 #endif
 
 namespace dynamicgraph {
   /* --------------------------------------------------------------------- */
   /* --- CLASS ----------------------------------------------------------- */
   /* --------------------------------------------------------------------- */
-  class DYNAMICGRAPHCONTIIFSTREAM_EXPORT Contiifstream
+  class DG_CONTIIFSTREAM_DLLAPI Contiifstream
   {
   protected:
     std::string filename;
diff --git a/include/dynamic-graph/shell-procedure.h b/include/dynamic-graph/shell-procedure.h
index 51c481f..e50d0a9 100644
--- a/include/dynamic-graph/shell-procedure.h
+++ b/include/dynamic-graph/shell-procedure.h
@@ -28,6 +28,7 @@
 /* DYNAMIC-GRAPH */
 #include <dynamic-graph/exception-factory.h>
 #include <dynamic-graph/interpreter.h>
+#include <dynamic-graph/config-shell-procedure.hh>
 
 /* --- STD --- */
 #include <string>
@@ -40,20 +41,6 @@
 #include <boost/function.hpp>
 #include <boost/bind.hpp>
 
-/* --------------------------------------------------------------------- */
-/* --- API ------------------------------------------------------------- */
-/* --------------------------------------------------------------------- */
-
-#if defined (WIN32)
-#  if defined (shell_procedure_EXPORTS)
-#    define ShellProcedure_EXPORT __declspec(dllexport)
-#  else
-#    define ShellProcedure_EXPORT __declspec(dllimport)
-#  endif
-#else
-#  define ShellProcedure_EXPORT
-#endif
-
 /* --------------------------------------------------------------------- */
 /* --- CLASS ----------------------------------------------------------- */
 /* --------------------------------------------------------------------- */
@@ -64,7 +51,7 @@
 
   For more information, load the plugin and type help on a sot shell.
  */
-class ShellProcedure_EXPORT ShellProcedure
+class DG_SHELLPROCEDURE_DLLAPI ShellProcedure
 {
  public:
   struct Instruction
diff --git a/include/dynamic-graph/tracer-real-time.h b/include/dynamic-graph/tracer-real-time.h
index c5728cf..b9ee965 100644
--- a/include/dynamic-graph/tracer-real-time.h
+++ b/include/dynamic-graph/tracer-real-time.h
@@ -30,20 +30,7 @@
 
 /* DG */
 #include <dynamic-graph/tracer.h>
-
-/* --------------------------------------------------------------------- */
-/* --- API ------------------------------------------------------------- */
-/* --------------------------------------------------------------------- */
-
-#if defined (WIN32)
-#  if defined (tracer_real_time_EXPORTS)
-#    define DGTRACERREALTIME_EXPORT __declspec(dllexport)
-#  else
-#    define DGTRACERREALTIME_EXPORT __declspec(dllimport)
-#  endif
-#else
-#  define DGTRACERREALTIME_EXPORT
-#endif
+#include <dynamic-graph/config-tracer-real-time.hh>
 
 /* --------------------------------------------------------------------- */
 /* --- TRACER ---------------------------------------------------------- */
@@ -51,7 +38,7 @@
 
 namespace dynamicgraph {
 
-class DGTRACERREALTIME_EXPORT OutStringStream
+class DG_TRACERREALTIME_DLLAPI OutStringStream
   : public std::ostringstream
 {
 public:
@@ -73,7 +60,7 @@ public:
 
 };
 
-class DGTRACERREALTIME_EXPORT TracerRealTime
+class DG_TRACERREALTIME_DLLAPI TracerRealTime
 : public Tracer
 {
  public:
@@ -108,7 +95,8 @@ class DGTRACERREALTIME_EXPORT TracerRealTime
 
   /* --- DISPLAY ------------------------------------------------------------ */
   void display( std::ostream& os ) const;
-  DGTRACERREALTIME_EXPORT friend std::ostream& operator<< ( std::ostream& os,const TracerRealTime& t );
+  DG_TRACERREALTIME_DLLAPI friend std::ostream& operator<<
+    (std::ostream& os, const TracerRealTime& t);
 
   /* --- PARAMS --- */
   virtual void commandLine( const std::string& cmdLine
@@ -121,5 +109,3 @@ class DGTRACERREALTIME_EXPORT TracerRealTime
 
 
 #endif /* #ifndef __TRACER_RT_H__ */
-
-
diff --git a/include/dynamic-graph/tracer.h b/include/dynamic-graph/tracer.h
index 28e0f80..7d5f323 100644
--- a/include/dynamic-graph/tracer.h
+++ b/include/dynamic-graph/tracer.h
@@ -37,19 +37,7 @@
 #include <dynamic-graph/entity.h>
 #include <dynamic-graph/exception-traces.h>
 
-/* --------------------------------------------------------------------- */
-/* --- API ------------------------------------------------------------- */
-/* --------------------------------------------------------------------- */
-
-#if defined (WIN32)
-#  if defined (tracer_EXPORTS)
-#    define DGTRACER_EXPORT __declspec(dllexport)
-#  else
-#    define DGTRACER_EXPORT __declspec(dllimport)
-#  endif
-#else
-#  define DGTRACER_EXPORT
-#endif
+#include <dynamic-graph/config-tracer.hh>
 
 /* --------------------------------------------------------------------- */
 /* --- TRACER ---------------------------------------------------------- */
@@ -57,8 +45,7 @@
 
 namespace dynamicgraph {
 
-class DGTRACER_EXPORT Tracer
-: public Entity
+class DG_TRACER_DLLAPI Tracer : public Entity
 {
  protected:
   typedef std::list< const SignalBase<int>* > SignalList;
@@ -126,7 +113,8 @@ class DGTRACER_EXPORT Tracer
   SignalTimeDependent<int,int> triger;
 
   /* --- DISPLAY ------------------------------------------------------------ */
-  DGTRACER_EXPORT friend std::ostream& operator<< ( std::ostream& os,const Tracer& t );
+  DG_TRACER_DLLAPI friend std::ostream& operator<<
+    (std::ostream& os,const Tracer& t);
 
   /* --- PARAMS --- */
   void display( std::ostream& os ) const;
@@ -140,5 +128,3 @@ class DGTRACER_EXPORT Tracer
 
 
 #endif /* #ifndef __TRACER_H__ */
-
-
-- 
GitLab