Merge pull request #166 from LambdAurora/dev
Added export of public symbols on Windows.
diff --git a/cmake_unofficial/CMakeLists.txt b/cmake_unofficial/CMakeLists.txt
index 1ca7a06..f66e72e 100644
--- a/cmake_unofficial/CMakeLists.txt
+++ b/cmake_unofficial/CMakeLists.txt
@@ -57,6 +57,9 @@
# libxxhash
add_library(xxhash "${XXHASH_DIR}/xxhash.c")
+if (BUILD_SHARED_LIBS)
+ target_compile_definitions(xxhash PUBLIC XXH_EXPORT)
+endif ()
set_target_properties(xxhash PROPERTIES
SOVERSION "${XXHASH_VERSION_STRING}"
VERSION "${XXHASH_VERSION_STRING}")
diff --git a/xxhash.h b/xxhash.h
index d6bad94..84942e8 100644
--- a/xxhash.h
+++ b/xxhash.h
@@ -107,7 +107,15 @@
# define XXH_PUBLIC_API static
# endif
#else
-# define XXH_PUBLIC_API /* do nothing */
+# if defined(WIN32) && !defined(__GNUC__)
+# ifdef XXH_EXPORT
+# define XXH_PUBLIC_API __declspec(dllexport)
+# else
+# define XXH_PUBLIC_API __declspec(dllimport)
+# endif
+# else
+# define XXH_PUBLIC_API /* do nothing */
+# endif
#endif /* XXH_INLINE_ALL || XXH_PRIVATE_API */
/*! XXH_NAMESPACE, aka Namespace Emulation :