summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--include/tgbot/export.h12
2 files changed, 16 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6587a48..4d916f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,3 +88,7 @@ if (ENABLE_TESTS)
enable_testing()
add_subdirectory(test)
endif()
+
+if(MSVC AND BUILD_SHARED_LIBS)
+ add_definitions(-DTGBOT_DLL)
+endif() \ No newline at end of file
diff --git a/include/tgbot/export.h b/include/tgbot/export.h
index 55789d9..3178a0e 100644
--- a/include/tgbot/export.h
+++ b/include/tgbot/export.h
@@ -2,7 +2,19 @@
#define TGBOT_EXPORT_H
#ifndef TGBOT_API
+#ifdef _MSC_VER
+#ifdef TGBOT_DLL
+#ifdef TgBot_EXPORTS
+#define TGBOT_API __declspec(dllexport)
+#else
+#define TGBOT_API __declspec(dllimport)
+#endif
+#else
+#define TGBOT_API
+#endif
+#else
#define TGBOT_API
#endif
+#endif
#endif //TGBOT_EXPORT_H