diff --git a/include/plist/plist.h b/include/plist/plist.h
index 2863c74..9cdb219 100644
--- a/include/plist/plist.h
+++ b/include/plist/plist.h
@@ -42,7 +42,7 @@ extern "C"
 #include <stdint.h>
 #endif
 
-#ifdef _MSC_VER 
+#if defined(_MSC_VER) && defined(LIBPLIST_EXPORTS)
 #define PLIST_API_MSC __declspec( dllexport ) 
 #else  
 #define PLIST_API_MSC 
diff --git a/src/plist.h b/src/plist.h
index 1e5d0d1..6690343 100644
--- a/src/plist.h
+++ b/src/plist.h
@@ -39,10 +39,7 @@
 #include <sys/time.h>
 #endif
 
-#ifdef _MSC_VER
-  #define PLIST_API __declspec( dllexport )
-#else
-#ifdef WIN32
+#if (defined(_MSC_VER) || defined(WIN32)) && defined(LIBPLIST_EXPORTS)
   #define PLIST_API __declspec( dllexport )
 #else
   #ifdef HAVE_FVISIBILITY
@@ -51,7 +48,6 @@
     #define PLIST_API
   #endif
 #endif
-#endif
 
 struct plist_data_s
 {
