diff --git a/apps/openmw-mp/CMakeLists.txt b/apps/openmw-mp/CMakeLists.txt
index 30762ac9e..abd1c6315 100644
--- a/apps/openmw-mp/CMakeLists.txt
+++ b/apps/openmw-mp/CMakeLists.txt
@@ -185,7 +185,7 @@ if (UNIX)
     target_link_libraries(tes3mp-server dl)
     # Fix for not visible pthreads functions for linker with glibc 2.15
     if(NOT APPLE)
-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic") # TODO: use -Wl,--dynamic-list=list.txt instead
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--exclude-libs,ALL -rdynamic -fvisibility=hidden")
         target_link_libraries(tes3mp-server ${CMAKE_THREAD_LIBS_INIT})
     endif(NOT APPLE)
 endif(UNIX)
diff --git a/apps/openmw-mp/Script/Platform.hpp b/apps/openmw-mp/Script/Platform.hpp
index a56447986..8fe7a6d6a 100644
--- a/apps/openmw-mp/Script/Platform.hpp
+++ b/apps/openmw-mp/Script/Platform.hpp
@@ -17,4 +17,12 @@
 #endif
 #endif
 
+#ifdef _WIN32
+#define EXPORT_APIFUNCTION extern "C" __declspec(dllexport)
+#define CDECL __cdecl
+#else
+#define EXPORT_APIFUNCTION extern "C" __attribute__ ((visibility ("default")))
+#define CDECL
+#endif
+
 #endif //PLATFORM_HPP