From ab9a75d74a0644952d1f968507b8242179403c2f Mon Sep 17 00:00:00 2001
From: Christoph Lehmann <christoph.lehmann@ufz.de>
Date: Mon, 17 Sep 2018 11:30:48 +0200
Subject: [PATCH] Fix linker error

---
 Applications/CLI/CMakeLists.txt               |  2 +-
 Applications/CLI/ogs_embedded_python.h        |  3 ++-
 BaseLib/ExportSymbol.h                        | 20 +++++++++++++++++++
 .../Python/PythonBoundaryConditionModule.h    |  3 ++-
 4 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 BaseLib/ExportSymbol.h

diff --git a/Applications/CLI/CMakeLists.txt b/Applications/CLI/CMakeLists.txt
index 180bbf2c4ea..f4e4a94213a 100644
--- a/Applications/CLI/CMakeLists.txt
+++ b/Applications/CLI/CMakeLists.txt
@@ -26,7 +26,7 @@ if(OGS_USE_PYTHON)
     # appropriate message should be presented. The note is kept for the case
     # that the automatic detection does not work due to whatever reason.
 
-    add_library(ogs_embedded_python STATIC ogs_embedded_python.cpp)
+    add_library(ogs_embedded_python ogs_embedded_python.cpp)
 
     # Performance warning from
     # https://github.com/pybind/pybind11/blob/master/docs/compiling.rst:
diff --git a/Applications/CLI/ogs_embedded_python.h b/Applications/CLI/ogs_embedded_python.h
index 758718298ba..c215a5f70df 100644
--- a/Applications/CLI/ogs_embedded_python.h
+++ b/Applications/CLI/ogs_embedded_python.h
@@ -10,11 +10,12 @@
 #pragma once
 
 #include <pybind11/embed.h>
+#include "BaseLib/ExportSymbol.h"
 
 namespace ApplicationsLib
 {
 /// Sets up an embedded Python interpreter and makes sure that the OpenGeoSys
 /// Python module is not removed by the linker.
-pybind11::scoped_interpreter setupEmbeddedPython();
+OGS_EXPORT_SYMBOL pybind11::scoped_interpreter setupEmbeddedPython();
 
 }  // namespace ApplicationsLib
diff --git a/BaseLib/ExportSymbol.h b/BaseLib/ExportSymbol.h
new file mode 100644
index 00000000000..63e4681ec48
--- /dev/null
+++ b/BaseLib/ExportSymbol.h
@@ -0,0 +1,20 @@
+/**
+ * \copyright
+ * Copyright (c) 2012-2018, OpenGeoSys Community (http://www.opengeosys.org)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/project/license
+ *
+ */
+
+#pragma once
+
+#ifndef OGS_EXPORT_SYMBOL
+#  if defined(WIN32) || defined(_WIN32)
+#    define OGS_EXPORT_SYMBOL __declspec(dllexport)
+#  else
+#    define OGS_EXPORT_SYMBOL __attribute__((visibility("default")))
+#  endif
+#endif  // defined(OGS_EXPORT_SYMBOL)
+
+
diff --git a/ProcessLib/BoundaryCondition/Python/PythonBoundaryConditionModule.h b/ProcessLib/BoundaryCondition/Python/PythonBoundaryConditionModule.h
index 82c141a4bc3..c52f4f9e7ca 100644
--- a/ProcessLib/BoundaryCondition/Python/PythonBoundaryConditionModule.h
+++ b/ProcessLib/BoundaryCondition/Python/PythonBoundaryConditionModule.h
@@ -10,9 +10,10 @@
 #pragma once
 
 #include <pybind11/pybind11.h>
+#include "BaseLib/ExportSymbol.h"
 
 namespace ProcessLib
 {
 //! Creates Python bindings for the Python BC class.
-void pythonBindBoundaryCondition(pybind11::module& m);
+OGS_EXPORT_SYMBOL void pythonBindBoundaryCondition(pybind11::module& m);
 }  // namespace ProcessLib
-- 
GitLab