aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libmodbus/library-linkage.diff
blob: 402363dfccbc0803c91f8c390e1e7acd022c7377 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
diff --git a/configure.ac b/configure.ac
index 9f30d29..29737da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -120,6 +120,14 @@ AC_C_INLINE
 # libtool
 AC_PROG_CXX
 
+if "$os_win32" = "true"; then
+  if test "$enable_shared" = "yes"; then
+    AC_DEFINE(DLLBUILD, [], [Building a DLL])
+  else
+    AC_DEFINE(STATIC_LIBMODBUS, [], [Building a static library])
+  fi
+fi
+
 # Various types
 AC_TYPE_INT64_T
 AC_TYPE_SIZE_T
diff --git a/src/modbus.h b/src/modbus.h
index fa7ec4a..ae204ce 100644
--- a/src/modbus.h
+++ b/src/modbus.h
@@ -25,6 +25,8 @@
 # if defined(DLLBUILD)
 /* define DLLBUILD when building the DLL */
 #  define MODBUS_API __declspec(dllexport)
+# elif defined(STATIC_LIBMODBUS)
+#  define MODBUS_API
 # else
 #  define MODBUS_API __declspec(dllimport)
 # endif