diff --git a/Applications/CLI/CMakeLists.txt b/Applications/CLI/CMakeLists.txt index 180bbf2c4ea0368437b2cad4203fd32d5d8c2acf..f4e4a94213a15deeb51a0f63eb7f6b1a620a471d 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 758718298ba1cb3e00d47338f58901d01ea82074..c215a5f70dfb820fc66fa389ac332b76d63c933d 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 0000000000000000000000000000000000000000..63e4681ec489307f964c96533bbdb3778a083b5d --- /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 82c141a4bc3aa73734b85f315aeb0576874b6cea..c52f4f9e7ca1f97a59892a7483b476258b7db1ec 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