diff --git a/include/dynamic-graph/python/interpreter.hh b/include/dynamic-graph/python/interpreter.hh
index e19d0220356eb84d4ec8da9a9b7871a2c75c0526..e0d8dad778d5a1d0f7d20690a86d52c2daf87ef6 100644
--- a/include/dynamic-graph/python/interpreter.hh
+++ b/include/dynamic-graph/python/interpreter.hh
@@ -50,6 +50,9 @@ namespace dynamicgraph {
       /// \param stream input stream
       std::string processStream(std::istream& stream, std::ostream& os);
 
+      /// \brief Return a pointer to the dictionary of global variables
+      PyObject* globals();
+
     private:
       /// Pointer to the dictionary of global variables
       PyObject* globals_;
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bbec789fc7d520298ab3c3873e89e4f2dcb10bd6..4f4fdd167b2d105b52f860fdec88de10baa954a4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -18,7 +18,9 @@
 #
 INCLUDE(FindPythonLibs)
 IF (NOT ${PYTHONLIBS_FOUND} STREQUAL TRUE)
-   MESSAGE(FATAL_ERROR "Python has not been found.")
+  MESSAGE(FATAL_ERROR "Python has not been found.")
+ELSE()
+  MESSAGE(STATUS "PYTHON_LIBRARY=${PYTHON_LIBRARY}")
 ENDIF (NOT ${PYTHONLIBS_FOUND} STREQUAL TRUE)
 
 INCLUDE(FindPythonInterp)
@@ -83,7 +85,9 @@ SET_TARGET_PROPERTIES(${PYTHON_MODULE}
 
 TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${DYNAMIC_GRAPH_LIBRARIES})
 
-INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
+CONFIG_FILES(link-to-python.hh)
+INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}
+  ${CMAKE_CURRENT_BINARY_DIR})
 
 #
 # Installation
diff --git a/src/interpreter.cc b/src/interpreter.cc
index ad3e44408ea7f590e2c2a29109ca154737c94c0c..31844ff5d9b236dc485578318da83721ac225f7e 100644
--- a/src/interpreter.cc
+++ b/src/interpreter.cc
@@ -16,6 +16,7 @@
 
 #include <iostream>
 #include "dynamic-graph/python/interpreter.hh"
+#include "link-to-python.hh"
 
 // Python initialization commands
 namespace dynamicgraph {
@@ -31,9 +32,13 @@ namespace dynamicgraph {
 }
 
 using dynamicgraph::python::Interpreter;
+using dynamicgraph::python::libpython;
 
 Interpreter::Interpreter()
 {
+  // load python dynamic library
+  // this is silly, but required to be able to import dl module.
+  dlopen(libpython.c_str(), RTLD_LAZY | RTLD_GLOBAL);
   Py_Initialize();
   mainmod_ = PyImport_AddModule("__main__");
   Py_INCREF(mainmod_);
@@ -98,6 +103,11 @@ std::string Interpreter::python( const std::string& command )
   return value;
 }
 
+PyObject* Interpreter::globals()
+{
+  return globals_;
+}
+
 void Interpreter::runPythonFile( std::string filename )
 {
   PyObject* pymainContext = globals_;
diff --git a/src/link-to-python.hh.in b/src/link-to-python.hh.in
new file mode 100644
index 0000000000000000000000000000000000000000..d282b4d84420b7695490712ab0f496a7d2857f2f
--- /dev/null
+++ b/src/link-to-python.hh.in
@@ -0,0 +1,27 @@
+// -*- mode: c++ -*-
+// Copyright 2011, Florent Lamiraux, CNRS.
+//
+// This file is part of dynamic-graph-python.
+// dynamic-graph is free software: you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation, either version 3 of
+// the License, or (at your option) any later version.
+//
+// dynamic-graph is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Lesser Public License for more details.  You should have
+// received a copy of the GNU Lesser General Public License along with
+// dynamic-graph. If not, see <http://www.gnu.org/licenses/>.
+
+#ifdef WIN32
+#include <Windows.h>
+#else
+#include <dlfcn.h>
+#endif
+
+namespace dynamicgraph {
+  namespace python {
+    std::string libpython("@PYTHON_LIBRARY@");
+  } // namespace python
+} // namespace dynamicgraph