diff --git a/include/dynamic-graph/python/exception-python.hh b/include/dynamic-graph/python/exception-python.hh
index 5374d4b9f2779f9a756ff3fb35682034c4eb8952..d0b84aba1cd48503a93480fdbac2ad9f27b84a6e 100644
--- a/include/dynamic-graph/python/exception-python.hh
+++ b/include/dynamic-graph/python/exception-python.hh
@@ -20,16 +20,27 @@
 # include <string>
 
 # include <dynamic-graph/fwd.hh>
-# include <dynamic-graph/dynamic-graph-api.h>
 # include <dynamic-graph/exception-abstract.h>
 
+// Depending on whether one is building or using the
+// library define DLLAPI to import or export.
+# if defined (WIN32)
+#   if defined (wrap_EXPORTS)
+#     define WRAP_DLLAPI __declspec(dllexport)
+#   else
+#     define WRAP_DLLAPI __declspec(dllimport)
+#   endif
+# else
+#   define WRAP_DLLAPI
+# endif
+
 namespace dynamicgraph {
   namespace python {
 
     /// \ingroup error
     ///
     /// \brief Generic error class.
-    class DYNAMIC_GRAPH_DLLAPI ExceptionPython : public ExceptionAbstract
+    class WRAP_DLLAPI ExceptionPython : public ExceptionAbstract
     {
     public:
       enum ErrorCodeEnum