diff --git a/include/usbmuxd.h b/include/usbmuxd.h
index 5a3b0c0..aa1c8d9 100644
--- a/include/usbmuxd.h
+++ b/include/usbmuxd.h
@@ -24,7 +24,7 @@
 #define USBMUXD_H
 #include <stdint.h>
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && defined(USBMUXD_EXPORTS)
 	#define USBMUXD_API_MSC __declspec( dllexport )
 #else
 	#ifdef HAVE_FVISIBILITY
diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c
index b94c83c..1902a55 100644
--- a/src/libusbmuxd.c
+++ b/src/libusbmuxd.c
@@ -34,7 +34,7 @@
 #include <stdio.h>
 #include <string.h>
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && defined(USBMUXD_EXPORTS)
   #define USBMUXD_API __declspec( dllexport )
 #else
   #define USBMUXD_API
