From 003381f417caaae9918cd81fa53bcc0547caa4c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sat, 14 Jul 2012 10:13:57 +0200
Subject: Initial DLL support for Swiften.

All applications succesfully link against Swiften.dll.

diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot
index d6d4e29..c246bf6 100644
--- a/BuildTools/SCons/SConscript.boot
+++ b/BuildTools/SCons/SConscript.boot
@@ -211,7 +211,7 @@ if env.get("coverage", 0) :
 if env["PLATFORM"] == "win32" :
 	env.Append(LIBS = ["user32", "crypt32", "dnsapi", "iphlpapi", "ws2_32", "wsock32", "Advapi32"])
 	env.Append(CCFLAGS = ["/EHsc", "/nologo"])
-	env.Append(LINKFLAGS = ["/INCREMENTAL:no"])
+	env.Append(LINKFLAGS = ["/INCREMENTAL:no", "/NOLOGO"])
 	if int(env["MSVS_VERSION"].split(".")[0]) < 10 :
 		env["LINKCOM"] = [env["LINKCOM"], 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;1']
 		env["SHLINKCOM"] = [env["SHLINKCOM"], 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;2']
diff --git a/Limber/Server/ServerFromClientSession.h b/Limber/Server/ServerFromClientSession.h
index 34ea40e..e2754b9 100644
--- a/Limber/Server/ServerFromClientSession.h
+++ b/Limber/Server/ServerFromClientSession.h
@@ -7,10 +7,10 @@
 #pragma once
 
 #include <boost/shared_ptr.hpp>
-#include <Swiften/Base/boost_bsignals.h>
 #include <boost/enable_shared_from_this.hpp>
-
 #include <string>
+
+#include <Swiften/Base/boost_bsignals.h>
 #include <Swiften/Session/Session.h>
 #include <Swiften/JID/JID.h>
 #include <Swiften/Network/Connection.h>
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index ef05a12..f935530 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -282,6 +282,8 @@ if env["PLATFORM"] == "win32" :
         #os.path.join(env["OPENSSL_DIR"], "bin", "libeay32.dll"),
         "#/Swift/resources/images",  
       ]
+    if env["SWIFTEN_DLL"] :
+      commonResources[""] = commonResources.get("", []) + ["#/Swiften/Swiften.dll"]
     qtimageformats = ["gif", "ico", "jpeg", "mng", "svg", "tiff"]
     qtlibs = ["QtCore4", "QtGui4", "QtNetwork4", "QtWebKit4", "QtXMLPatterns4", "phonon4"]
     myenv.WindowsBundle("Swift", 
diff --git a/Swiften/AdHoc/OutgoingAdHocCommandSession.h b/Swiften/AdHoc/OutgoingAdHocCommandSession.h
index 7c7cc99..74d6c59 100644
--- a/Swiften/AdHoc/OutgoingAdHocCommandSession.h
+++ b/Swiften/AdHoc/OutgoingAdHocCommandSession.h
@@ -10,6 +10,7 @@
 #include <string>
 #include <map>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/JID/JID.h>
 #include <Swiften/Base/boost_bsignals.h>
 #include <Swiften/Elements/Command.h>
@@ -21,7 +22,7 @@ namespace Swift {
 	class MainWindow;
 	class UIEventStream;
 
-	class OutgoingAdHocCommandSession {
+	class SWIFTEN_API OutgoingAdHocCommandSession {
 		public:
 
 			/**
diff --git a/Swiften/Avatars/AvatarStorage.h b/Swiften/Avatars/AvatarStorage.h
index c33d38b..7f61ca2 100644
--- a/Swiften/Avatars/AvatarStorage.h
+++ b/Swiften/Avatars/AvatarStorage.h
@@ -8,12 +8,14 @@
 
 #include <boost/filesystem/path.hpp>
 #include <string>
+
+#include <Swiften/Base/API.h>
 #include <Swiften/Base/ByteArray.h>
 
 namespace Swift {
 	class JID;
 
-	class AvatarStorage {
+	class SWIFTEN_API AvatarStorage {
 		public:
 			virtual ~AvatarStorage();
 
diff --git a/Swiften/Base/API.h b/Swiften/Base/API.h
new file mode 100644
index 0000000..8f19446
--- /dev/null
+++ b/Swiften/Base/API.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2012 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/Platform.h>
+
+#ifdef SWIFTEN_STATIC
+# define SWIFTEN_API 
+#else
+# ifdef SWIFTEN_PLATFORM_WINDOWS
+#  ifdef SWIFTEN_BUILDING
+#   define SWIFTEN_API __declspec(dllexport)
+#  else
+#   define SWIFTEN_API __declspec(dllimport)
+#  endif
+# else
+#  define SWIFTEN_API 
+# endif
+#endif
diff --git a/Swiften/Base/ByteArray.h b/Swiften/Base/ByteArray.h
index 01cd5d0..34b89d3 100644
--- a/Swiften/Base/ByteArray.h
+++ b/Swiften/Base/ByteArray.h
@@ -9,11 +9,13 @@
 #include <vector>
 #include <string>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
 	typedef std::vector<unsigned char> ByteArray;
 
-	ByteArray createByteArray(const std::string& s);
-	ByteArray createByteArray(const char* c);
+	SWIFTEN_API ByteArray createByteArray(const std::string& s);
+	SWIFTEN_API ByteArray createByteArray(const char* c);
 
 	inline ByteArray createByteArray(const unsigned char* c, size_t n) {
 		return ByteArray(c, c  + n);
@@ -37,8 +39,8 @@ namespace Swift {
 		return v.empty() ? NULL : &v[0];
 	}
 			
-	std::string byteArrayToString(const ByteArray& b);
+	SWIFTEN_API std::string byteArrayToString(const ByteArray& b);
 
-	void readByteArrayFromFile(ByteArray&, const std::string& file);
+	SWIFTEN_API void readByteArrayFromFile(ByteArray&, const std::string& file);
 }
 
diff --git a/Swiften/Base/Error.h b/Swiften/Base/Error.h
index e99f175..906c1d9 100644
--- a/Swiften/Base/Error.h
+++ b/Swiften/Base/Error.h
@@ -6,8 +6,10 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
-	class Error {
+	class SWIFTEN_API Error {
 		public:
 			virtual ~Error();
 	};
diff --git a/Swiften/Base/IDGenerator.h b/Swiften/Base/IDGenerator.h
index 44eeb76..14ecfdc 100644
--- a/Swiften/Base/IDGenerator.h
+++ b/Swiften/Base/IDGenerator.h
@@ -8,8 +8,10 @@
 
 #include <string>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
-	class IDGenerator {
+	class SWIFTEN_API IDGenerator {
 		public:
 			IDGenerator();
 
diff --git a/Swiften/Base/Log.h b/Swiften/Base/Log.h
index 06f5b55..6d76dc6 100644
--- a/Swiften/Base/Log.h
+++ b/Swiften/Base/Log.h
@@ -8,8 +8,10 @@
 
 #include <iostream>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
-	extern bool logging;
+	extern SWIFTEN_API bool logging;
 	namespace LogDetail {
 		// Only here to be able to statically check the correctness of the severity levers
 		namespace Severity {
diff --git a/Swiften/Base/Paths.h b/Swiften/Base/Paths.h
index 8ac4640..94e62d1 100644
--- a/Swiften/Base/Paths.h
+++ b/Swiften/Base/Paths.h
@@ -8,8 +8,10 @@
 
 #include <boost/filesystem/path.hpp>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
-	class Paths {
+	class SWIFTEN_API Paths {
 		public:
 			static boost::filesystem::path getExecutablePath();
 	};
diff --git a/Swiften/Base/SafeByteArray.h b/Swiften/Base/SafeByteArray.h
index 1ef1d84..dda51fe 100644
--- a/Swiften/Base/SafeByteArray.h
+++ b/Swiften/Base/SafeByteArray.h
@@ -8,6 +8,7 @@
 
 #include <vector>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Base/SafeAllocator.h>
 #include <Swiften/Base/ByteArray.h>
 #include <boost/smart_ptr/make_shared.hpp>
@@ -19,7 +20,7 @@ namespace Swift {
 		return SafeByteArray(a.begin(), a.end());
 	}
 
-	SafeByteArray createSafeByteArray(const char* c);
+	SWIFTEN_API SafeByteArray createSafeByteArray(const char* c);
 
 	inline SafeByteArray createSafeByteArray(const std::string& s) {
 		return SafeByteArray(s.begin(), s.end());
diff --git a/Swiften/Base/String.h b/Swiften/Base/String.h
index db6c28b..26cc3f4 100644
--- a/Swiften/Base/String.h
+++ b/Swiften/Base/String.h
@@ -10,15 +10,17 @@
 #include <vector>
 #include <sstream>
 
+#include <Swiften/Base/API.h>
+
 #define SWIFTEN_STRING_TO_CFSTRING(a) \
 	CFStringCreateWithBytes(NULL, reinterpret_cast<const UInt8*>(a.c_str()), a.size(), kCFStringEncodingUTF8, false)
 
 namespace Swift {
 	namespace String {
-			std::vector<unsigned int> getUnicodeCodePoints(const std::string&);
-			std::pair<std::string, std::string> getSplittedAtFirst(const std::string&, char c);
-			std::vector<std::string> split(const std::string&, char c);
-			void replaceAll(std::string&, char c, const std::string& s);
+			SWIFTEN_API std::vector<unsigned int> getUnicodeCodePoints(const std::string&);
+			SWIFTEN_API std::pair<std::string, std::string> getSplittedAtFirst(const std::string&, char c);
+			SWIFTEN_API std::vector<std::string> split(const std::string&, char c);
+			SWIFTEN_API void replaceAll(std::string&, char c, const std::string& s);
 
 			inline bool beginsWith(const std::string& s, char c) { 
 				return s.size() > 0 && s[0] == c; 
@@ -29,7 +31,7 @@ namespace Swift {
 			}
 	};
 
-	class makeString {
+	class SWIFTEN_API makeString {
 		public:
 			 template <typename T> makeString& operator<<(T const& v) {
 					stream << v;
diff --git a/Swiften/Base/sleep.h b/Swiften/Base/sleep.h
index a95e907..afcf6c7 100644
--- a/Swiften/Base/sleep.h
+++ b/Swiften/Base/sleep.h
@@ -6,6 +6,8 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
-	void sleep(unsigned int msecs);
+	SWIFTEN_API void sleep(unsigned int msecs);
 }
diff --git a/Swiften/Chat/ChatStateNotifier.h b/Swiften/Chat/ChatStateNotifier.h
index c691092..5b99266 100644
--- a/Swiften/Chat/ChatStateNotifier.h
+++ b/Swiften/Chat/ChatStateNotifier.h
@@ -9,6 +9,7 @@
 #include <Swiften/Base/boost_bsignals.h>
 #include <boost/shared_ptr.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/Message.h>
 #include <Swiften/Elements/ChatState.h>
 #include <Swiften/JID/JID.h>
@@ -17,7 +18,7 @@ namespace Swift {
 	class StanzaChannel;
 	class EntityCapsProvider;
 
-	class ChatStateNotifier {
+	class SWIFTEN_API ChatStateNotifier {
 		public:
 			ChatStateNotifier(StanzaChannel* stanzaChannel, const JID& contact, EntityCapsProvider* entityCapsManager);
 			~ChatStateNotifier();
diff --git a/Swiften/Chat/ChatStateTracker.h b/Swiften/Chat/ChatStateTracker.h
index b356644..e401b0a 100644
--- a/Swiften/Chat/ChatStateTracker.h
+++ b/Swiften/Chat/ChatStateTracker.h
@@ -8,13 +8,14 @@
 
 #include <Swiften/Base/boost_bsignals.h>
 #include <boost/shared_ptr.hpp>
+#include <Swiften/Base/API.h>
 
 #include <Swiften/Elements/Message.h>
 #include <Swiften/Elements/Presence.h>
 #include <Swiften/Elements/ChatState.h>
 
 namespace Swift {
-	class ChatStateTracker {
+	class SWIFTEN_API ChatStateTracker {
 		public:
 			ChatStateTracker();
 			void handleMessageReceived(boost::shared_ptr<Message> message);
diff --git a/Swiften/Client/Client.h b/Swiften/Client/Client.h
index 940a526..9652b16 100644
--- a/Swiften/Client/Client.h
+++ b/Swiften/Client/Client.h
@@ -6,8 +6,8 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Client/CoreClient.h>
-
 #include <Swiften/Base/SafeString.h>
 
 namespace Swift {
@@ -43,7 +43,7 @@ namespace Swift {
 	 * Besides connecting to an XMPP server, this class also provides interfaces for
 	 * performing most tasks on the XMPP network.
 	 */
-	class Client : public CoreClient {
+	class SWIFTEN_API Client : public CoreClient {
 		public:
 			/**
 			 * Constructs a client for the given JID with the given password.
diff --git a/Swiften/Client/ClientXMLTracer.h b/Swiften/Client/ClientXMLTracer.h
index 67040c4..91cfe22 100644
--- a/Swiften/Client/ClientXMLTracer.h
+++ b/Swiften/Client/ClientXMLTracer.h
@@ -6,12 +6,13 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Client/CoreClient.h>
 #include <Swiften/Client/XMLBeautifier.h>
 #include <Swiften/Base/SafeByteArray.h>
 
 namespace Swift {
-	class ClientXMLTracer {
+	class SWIFTEN_API ClientXMLTracer {
 		public:
 			ClientXMLTracer(CoreClient* client, bool bosh = false);
 			~ClientXMLTracer();
diff --git a/Swiften/Client/CoreClient.h b/Swiften/Client/CoreClient.h
index 4bb04e2..c9da0eb 100644
--- a/Swiften/Client/CoreClient.h
+++ b/Swiften/Client/CoreClient.h
@@ -8,8 +8,9 @@
 
 #include <string>
 #include <boost/shared_ptr.hpp>
-#include <Swiften/Base/boost_bsignals.h>
 
+#include <Swiften/Base/API.h>
+#include <Swiften/Base/boost_bsignals.h>
 #include <Swiften/Entity/Entity.h>
 #include <Swiften/JID/JID.h>
 #include <Swiften/Client/ClientError.h>
@@ -45,7 +46,7 @@ namespace Swift {
 	 * subclass provides more functionality and interfaces, and is better suited
 	 * for most needs.
 	 */
-	class CoreClient : public Entity {
+	class SWIFTEN_API CoreClient : public Entity {
 		public: 
 			/**
 			 * Constructs a client for the given JID with the given password.
diff --git a/Swiften/Client/NickResolver.h b/Swiften/Client/NickResolver.h
index 584f2ce..306703e 100644
--- a/Swiften/Client/NickResolver.h
+++ b/Swiften/Client/NickResolver.h
@@ -6,9 +6,10 @@
 
 #include <map>
 #include <boost/shared_ptr.hpp>
+#include <string>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Base/boost_bsignals.h>
-#include <string>
 #include <Swiften/JID/JID.h>
 #include <Swiften/Elements/VCard.h>
 
@@ -16,7 +17,8 @@ namespace Swift {
 	class XMPPRoster;
 	class MUCRegistry;
 	class VCardManager;
-	class NickResolver {
+
+	class SWIFTEN_API NickResolver {
 		public:
 			NickResolver(const JID& ownJID, XMPPRoster* xmppRoster, VCardManager* vcardManager, MUCRegistry* mucRegistry);
 
diff --git a/Swiften/Client/Storages.h b/Swiften/Client/Storages.h
index 1c5bbe9..89b770c 100644
--- a/Swiften/Client/Storages.h
+++ b/Swiften/Client/Storages.h
@@ -6,6 +6,8 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
 	class VCardStorage;
 	class AvatarStorage;
@@ -16,7 +18,7 @@ namespace Swift {
 	 * An interface to hold storage classes for different
 	 * controllers.
 	 */
-	class Storages {
+	class SWIFTEN_API Storages {
 		public:
 			virtual ~Storages();
 
diff --git a/Swiften/Component/Component.h b/Swiften/Component/Component.h
index 0b29ff7..f3ae9e8 100644
--- a/Swiften/Component/Component.h
+++ b/Swiften/Component/Component.h
@@ -6,6 +6,7 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Component/CoreComponent.h>
 
 namespace Swift {
@@ -17,7 +18,7 @@ namespace Swift {
 	 * Besides connecting to an XMPP server, this class also provides interfaces for
 	 * performing most component tasks on the XMPP network.
 	 */
-	class Component : public CoreComponent {
+	class SWIFTEN_API Component : public CoreComponent {
 		public:
 			Component(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const std::string& secret);
 			~Component();
diff --git a/Swiften/Component/ComponentXMLTracer.h b/Swiften/Component/ComponentXMLTracer.h
index c12ec07..57b9dcf 100644
--- a/Swiften/Component/ComponentXMLTracer.h
+++ b/Swiften/Component/ComponentXMLTracer.h
@@ -6,10 +6,11 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Component/Component.h>
 
 namespace Swift {
-	class ComponentXMLTracer {
+	class SWIFTEN_API ComponentXMLTracer {
 		public:
 			ComponentXMLTracer(CoreComponent* component);
 
diff --git a/Swiften/Component/CoreComponent.h b/Swiften/Component/CoreComponent.h
index e7945d1..4f39ffd 100644
--- a/Swiften/Component/CoreComponent.h
+++ b/Swiften/Component/CoreComponent.h
@@ -8,6 +8,7 @@
 
 #include <boost/shared_ptr.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Base/boost_bsignals.h>
 #include <Swiften/Base/Error.h>
 #include <Swiften/Network/PlatformDomainNameResolver.h>
@@ -40,7 +41,7 @@ namespace Swift {
 	 * subclass provides more functionality and interfaces, and is better suited 
 	 * for most needs.
 	 */
-	class CoreComponent : public Entity {
+	class SWIFTEN_API CoreComponent : public Entity {
 		public:
 			CoreComponent(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const std::string& secret);
 			~CoreComponent();
diff --git a/Swiften/Disco/CapsStorage.h b/Swiften/Disco/CapsStorage.h
index fb6e442..7420c28 100644
--- a/Swiften/Disco/CapsStorage.h
+++ b/Swiften/Disco/CapsStorage.h
@@ -9,11 +9,10 @@
 #include <boost/shared_ptr.hpp>
 
 #include <Swiften/Elements/DiscoInfo.h>
+#include <Swiften/Base/API.h>
 
 namespace Swift {
-	
-
-	class CapsStorage {
+	class SWIFTEN_API CapsStorage {
 		public:
 			virtual ~CapsStorage();
 
diff --git a/Swiften/Disco/ClientDiscoManager.h b/Swiften/Disco/ClientDiscoManager.h
index 6f126eb..0cae40e 100644
--- a/Swiften/Disco/ClientDiscoManager.h
+++ b/Swiften/Disco/ClientDiscoManager.h
@@ -6,6 +6,7 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/CapsInfo.h>
 #include <Swiften/Elements/DiscoInfo.h>
 #include <Swiften/Presence/PayloadAddingPresenceSender.h>
@@ -26,7 +27,7 @@ namespace Swift {
 	 * call setDiscoInfo() with the capabilities for the client. This can be
 	 * called whenever the capabilities change.
 	 */
-	class ClientDiscoManager {
+	class SWIFTEN_API ClientDiscoManager {
 		public:
 			/**
 			 * Constructs the manager
diff --git a/Swiften/Disco/DiscoServiceWalker.h b/Swiften/Disco/DiscoServiceWalker.h
index fd749fc..1853b57 100644
--- a/Swiften/Disco/DiscoServiceWalker.h
+++ b/Swiften/Disco/DiscoServiceWalker.h
@@ -9,6 +9,7 @@
 #include <vector>
 #include <set>
 
+#include <Swiften/Base/API.h>
 #include <boost/shared_ptr.hpp>
 #include <Swiften/Base/boost_bsignals.h>
 #include <string>
@@ -25,7 +26,7 @@ namespace Swift {
 	 * Recursively walk service discovery trees to find all services offered.
 	 * This stops on any disco item that's not reporting itself as a server.
 	 */
-	class DiscoServiceWalker {
+	class SWIFTEN_API DiscoServiceWalker {
 		public:
 			DiscoServiceWalker(const JID& service, IQRouter* iqRouter, size_t maxSteps = 200);
 
diff --git a/Swiften/Elements/DiscoInfo.h b/Swiften/Elements/DiscoInfo.h
index fec60d6..8add815 100644
--- a/Swiften/Elements/DiscoInfo.h
+++ b/Swiften/Elements/DiscoInfo.h
@@ -9,6 +9,7 @@
 #include <vector>
 #include <string>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/Payload.h>
 #include <Swiften/Elements/Form.h>
 
@@ -16,7 +17,7 @@ namespace Swift {
 	/**
 	 * disco#info from XEP-0030
 	 */
-	class DiscoInfo : public Payload {
+	class SWIFTEN_API DiscoInfo : public Payload {
 		public:
 			typedef boost::shared_ptr<DiscoInfo> ref;
 
diff --git a/Swiften/Elements/Element.h b/Swiften/Elements/Element.h
index 1e6a9d0..638418d 100644
--- a/Swiften/Elements/Element.h
+++ b/Swiften/Elements/Element.h
@@ -6,8 +6,10 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
-	class Element {
+	class SWIFTEN_API Element {
 		public:
 			virtual ~Element();
 	};
diff --git a/Swiften/Elements/Form.h b/Swiften/Elements/Form.h
index 2c6f963..bd4a2aa 100644
--- a/Swiften/Elements/Form.h
+++ b/Swiften/Elements/Form.h
@@ -9,6 +9,7 @@
 #include <vector>
 #include <string>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/Payload.h>
 #include <Swiften/Elements/FormField.h>
 #include <Swiften/JID/JID.h>
@@ -19,7 +20,7 @@ namespace Swift {
 	 * For the relevant Fields, the parsers and serialisers protect the API user against
 	 * the strange multi-value instead of newline thing by transforming them.
 	 */
-	class Form : public Payload {
+	class SWIFTEN_API Form : public Payload {
 		public:
 			typedef boost::shared_ptr<Form> ref;
 			typedef std::vector<FormField::ref> FormItem;
diff --git a/Swiften/Elements/IQ.h b/Swiften/Elements/IQ.h
index 99561f8..ff978b3 100644
--- a/Swiften/Elements/IQ.h
+++ b/Swiften/Elements/IQ.h
@@ -8,11 +8,12 @@
 
 #include <boost/shared_ptr.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/Stanza.h>
 #include <Swiften/Elements/ErrorPayload.h>
 
 namespace Swift {
-	class IQ : public Stanza {
+	class SWIFTEN_API IQ : public Stanza {
 		public:
 			typedef boost::shared_ptr<IQ> ref;
 
diff --git a/Swiften/Elements/MUCOccupant.h b/Swiften/Elements/MUCOccupant.h
index 931f544..023643c 100644
--- a/Swiften/Elements/MUCOccupant.h
+++ b/Swiften/Elements/MUCOccupant.h
@@ -7,14 +7,15 @@
 #pragma once
 
 #include <boost/optional.hpp>
-
 #include <string>
+
+#include <Swiften/Base/API.h>
 #include <Swiften/JID/JID.h>
 
 namespace Swift {
 	class Client;
 
-	class MUCOccupant {
+	class SWIFTEN_API MUCOccupant {
 		public:
 			enum Role {Moderator, Participant, Visitor, NoRole};
 			enum Affiliation {Owner, Admin, Member, Outcast, NoAffiliation};
diff --git a/Swiften/Elements/Payload.h b/Swiften/Elements/Payload.h
index f994ebc..15a72d5 100644
--- a/Swiften/Elements/Payload.h
+++ b/Swiften/Elements/Payload.h
@@ -8,8 +8,10 @@
 
 #include <boost/shared_ptr.hpp>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
-	class Payload {
+	class SWIFTEN_API Payload {
 		public:
 			typedef boost::shared_ptr<Payload> ref;
 		public:
diff --git a/Swiften/Elements/Presence.h b/Swiften/Elements/Presence.h
index 28a9ee5..2e9e224 100644
--- a/Swiften/Elements/Presence.h
+++ b/Swiften/Elements/Presence.h
@@ -8,11 +8,12 @@
 
 #include <boost/smart_ptr/make_shared.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/Stanza.h>
 #include <Swiften/Elements/StatusShow.h>
 
 namespace Swift {
-	class Presence : public Stanza {
+	class SWIFTEN_API Presence : public Stanza {
 		public:
 			typedef boost::shared_ptr<Presence> ref;
 
diff --git a/Swiften/Elements/SecurityLabelsCatalog.h b/Swiften/Elements/SecurityLabelsCatalog.h
index 5498fcf..420cf6f 100644
--- a/Swiften/Elements/SecurityLabelsCatalog.h
+++ b/Swiften/Elements/SecurityLabelsCatalog.h
@@ -10,12 +10,13 @@
 #include <string>
 #include <boost/shared_ptr.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/JID/JID.h>
 #include <Swiften/Elements/Payload.h>
 #include <Swiften/Elements/SecurityLabel.h>
 
 namespace Swift {
-	class SecurityLabelsCatalog : public Payload {
+	class SWIFTEN_API SecurityLabelsCatalog : public Payload {
 		public:
 			typedef boost::shared_ptr<SecurityLabelsCatalog> ref;
 			class Item {
diff --git a/Swiften/Elements/SoftwareVersion.h b/Swiften/Elements/SoftwareVersion.h
index c49b47b..e0eeaa3 100644
--- a/Swiften/Elements/SoftwareVersion.h
+++ b/Swiften/Elements/SoftwareVersion.h
@@ -9,10 +9,11 @@
 #include <string>
 #include <boost/shared_ptr.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/Payload.h>
 
 namespace Swift {
-	class SoftwareVersion : public Payload {
+	class SWIFTEN_API SoftwareVersion : public Payload {
 		public:
 			typedef boost::shared_ptr<SoftwareVersion> ref;
 
diff --git a/Swiften/Elements/Stanza.h b/Swiften/Elements/Stanza.h
index 9e082cc..fbb0139 100644
--- a/Swiften/Elements/Stanza.h
+++ b/Swiften/Elements/Stanza.h
@@ -12,13 +12,14 @@
 #include <boost/optional/optional_fwd.hpp>
 #include <boost/date_time/posix_time/ptime.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/Element.h>
 #include <Swiften/JID/JID.h>
 
 namespace Swift {
 	class Payload;
 
-	class Stanza : public Element {
+	class SWIFTEN_API Stanza : public Element {
 		public:
 			typedef boost::shared_ptr<Stanza> ref;
 
diff --git a/Swiften/Entity/Entity.h b/Swiften/Entity/Entity.h
index 65480d0..0dc2929 100644
--- a/Swiften/Entity/Entity.h
+++ b/Swiften/Entity/Entity.h
@@ -6,6 +6,8 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
 	class PayloadParserFactory;
 	class PayloadSerializer;
@@ -17,7 +19,7 @@ namespace Swift {
 	/** 
 	 * The base class for XMPP entities (Clients, Components).
 	 */
-	class Entity  {
+	class SWIFTEN_API Entity  {
 		public: 
 			Entity();
 			virtual ~Entity();
diff --git a/Swiften/Entity/PayloadPersister.h b/Swiften/Entity/PayloadPersister.h
index ea7c74c..bc406ab 100644
--- a/Swiften/Entity/PayloadPersister.h
+++ b/Swiften/Entity/PayloadPersister.h
@@ -9,12 +9,14 @@
 #include <boost/shared_ptr.hpp>
 #include <boost/filesystem/path.hpp>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
 	class Payload;
 	class PayloadSerializer;
 	class PayloadParser;
 
-	class PayloadPersister {
+	class SWIFTEN_API PayloadPersister {
 		public: 
 			PayloadPersister();
 			virtual ~PayloadPersister();
diff --git a/Swiften/EventLoop/DummyEventLoop.h b/Swiften/EventLoop/DummyEventLoop.h
index 4c01c16..0e5e06d 100644
--- a/Swiften/EventLoop/DummyEventLoop.h
+++ b/Swiften/EventLoop/DummyEventLoop.h
@@ -8,10 +8,11 @@
 
 #include <deque>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/EventLoop/EventLoop.h>
 
 namespace Swift {
-	class DummyEventLoop : public EventLoop {
+	class SWIFTEN_API DummyEventLoop : public EventLoop {
 		public:
 			DummyEventLoop();
 			~DummyEventLoop();
diff --git a/Swiften/EventLoop/EventLoop.h b/Swiften/EventLoop/EventLoop.h
index 9e47112..4a602ae 100644
--- a/Swiften/EventLoop/EventLoop.h
+++ b/Swiften/EventLoop/EventLoop.h
@@ -11,11 +11,13 @@
 #include <list>
 #include <deque>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/EventLoop/Event.h>
 
 namespace Swift {
 	class EventOwner;
-	class EventLoop {
+
+	class SWIFTEN_API EventLoop {
 		public:
 			EventLoop();
 			virtual ~EventLoop();
diff --git a/Swiften/EventLoop/EventOwner.h b/Swiften/EventLoop/EventOwner.h
index 4bbd1c4..43a059b 100644
--- a/Swiften/EventLoop/EventOwner.h
+++ b/Swiften/EventLoop/EventOwner.h
@@ -6,8 +6,10 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
-	class EventOwner {
+	class SWIFTEN_API EventOwner {
 		public:
 			virtual ~EventOwner();
 	};
diff --git a/Swiften/EventLoop/SimpleEventLoop.h b/Swiften/EventLoop/SimpleEventLoop.h
index 72bd6a6..da1c039 100644
--- a/Swiften/EventLoop/SimpleEventLoop.h
+++ b/Swiften/EventLoop/SimpleEventLoop.h
@@ -11,10 +11,11 @@
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition_variable.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/EventLoop/EventLoop.h>
 
 namespace Swift {
-	class SimpleEventLoop : public EventLoop {
+	class SWIFTEN_API SimpleEventLoop : public EventLoop {
 		public:
 			SimpleEventLoop();
 			~SimpleEventLoop();
diff --git a/Swiften/FileTransfer/FileReadBytestream.h b/Swiften/FileTransfer/FileReadBytestream.h
index e9db2a4..4a2d738 100644
--- a/Swiften/FileTransfer/FileReadBytestream.h
+++ b/Swiften/FileTransfer/FileReadBytestream.h
@@ -9,10 +9,11 @@
 #include <boost/filesystem/path.hpp>
 #include <boost/filesystem/fstream.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/FileTransfer/ReadBytestream.h>
 
 namespace Swift {
-	class FileReadBytestream : public ReadBytestream {
+	class SWIFTEN_API FileReadBytestream : public ReadBytestream {
 		public:
 			FileReadBytestream(const boost::filesystem::path& file);
 			~FileReadBytestream();
diff --git a/Swiften/FileTransfer/FileWriteBytestream.h b/Swiften/FileTransfer/FileWriteBytestream.h
index 82c4a65..f72ac17 100644
--- a/Swiften/FileTransfer/FileWriteBytestream.h
+++ b/Swiften/FileTransfer/FileWriteBytestream.h
@@ -9,10 +9,11 @@
 #include <boost/filesystem/path.hpp>
 #include <boost/filesystem/fstream.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/FileTransfer/WriteBytestream.h>
 
 namespace Swift {
-	class FileWriteBytestream : public WriteBytestream {
+	class SWIFTEN_API FileWriteBytestream : public WriteBytestream {
 		public:
 			FileWriteBytestream(const boost::filesystem::path& file);
 			~FileWriteBytestream();
diff --git a/Swiften/JID/JID.h b/Swiften/JID/JID.h
index a4461ba..08309d3 100644
--- a/Swiften/JID/JID.h
+++ b/Swiften/JID/JID.h
@@ -10,6 +10,8 @@
 //#include <iosfwd>
 #include <iostream>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
 	/**
 	 * This represents the JID used in XMPP
@@ -22,7 +24,7 @@ namespace Swift {
 	 * A JID can be invalid (when isValid() returns false). No member methods are 
 	 * guaranteed to work correctly if they do.
 	 */
-	class JID {
+	class SWIFTEN_API JID {
 		public:
 			enum CompareType {
 				WithResource, WithoutResource
diff --git a/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h b/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h
index ca5570f..2eb21ed 100644
--- a/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h
+++ b/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h
@@ -8,11 +8,13 @@
 
 #include <boost/shared_ptr.hpp>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
 	class DNSSDQuerier;
 	class EventLoop;
 
-	class PlatformDNSSDQuerierFactory {
+	class SWIFTEN_API PlatformDNSSDQuerierFactory {
 		public:
 			PlatformDNSSDQuerierFactory(EventLoop* eventLoop);
 
diff --git a/Swiften/MUC/MUC.h b/Swiften/MUC/MUC.h
index 60ed697..85f4564 100644
--- a/Swiften/MUC/MUC.h
+++ b/Swiften/MUC/MUC.h
@@ -7,6 +7,7 @@
 #pragma once
 
 #include <Swiften/JID/JID.h>
+#include <Swiften/Base/API.h>
 #include <string>
 #include <Swiften/Elements/Message.h>
 #include <Swiften/Elements/Presence.h>
@@ -27,7 +28,7 @@ namespace Swift {
 	class IQRouter;
 	class DirectedPresenceSender;
 
-	class MUC {
+	class SWIFTEN_API MUC {
 		public:
 			typedef boost::shared_ptr<MUC> ref;
 
diff --git a/Swiften/MUC/MUCBookmarkManager.h b/Swiften/MUC/MUCBookmarkManager.h
index ccea46c..667caa4 100644
--- a/Swiften/MUC/MUCBookmarkManager.h
+++ b/Swiften/MUC/MUCBookmarkManager.h
@@ -12,6 +12,7 @@
 #include <Swiften/Base/boost_bsignals.h>
 #include <boost/optional.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/MUC/MUCBookmark.h>
 #include <Swiften/Elements/Storage.h>
 #include <Swiften/Elements/ErrorPayload.h>
@@ -19,7 +20,7 @@
 namespace Swift {
 	class IQRouter;
 
-	class MUCBookmarkManager {
+	class SWIFTEN_API MUCBookmarkManager {
 		public:
 			MUCBookmarkManager(IQRouter* iqRouter);
 
diff --git a/Swiften/MUC/MUCManager.h b/Swiften/MUC/MUCManager.h
index 36ae61e..cf9000b 100644
--- a/Swiften/MUC/MUCManager.h
+++ b/Swiften/MUC/MUCManager.h
@@ -6,6 +6,7 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/MUC/MUC.h>
 
 namespace Swift {
@@ -14,7 +15,7 @@ namespace Swift {
 	class DirectedPresenceSender;
 	class MUCRegistry;
 
-	class MUCManager {
+	class SWIFTEN_API MUCManager {
 		public:
 			MUCManager(StanzaChannel* stanzaChannel, IQRouter* iqRouter, DirectedPresenceSender* presenceSender, MUCRegistry* mucRegistry);
 
diff --git a/Swiften/MUC/MUCRegistry.h b/Swiften/MUC/MUCRegistry.h
index 0ed2d2e..6ad1b89 100644
--- a/Swiften/MUC/MUCRegistry.h
+++ b/Swiften/MUC/MUCRegistry.h
@@ -8,12 +8,13 @@
 
 #include <vector>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/JID/JID.h>
 
 namespace Swift {
 	class JID;
 
-	class MUCRegistry {
+	class SWIFTEN_API MUCRegistry {
 		public:
 			~MUCRegistry();
 
diff --git a/Swiften/Network/BoostConnection.h b/Swiften/Network/BoostConnection.h
index 0e29c54..636853a 100644
--- a/Swiften/Network/BoostConnection.h
+++ b/Swiften/Network/BoostConnection.h
@@ -11,6 +11,7 @@
 #include <boost/enable_shared_from_this.hpp>
 #include <boost/thread/mutex.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Network/Connection.h>
 #include <Swiften/EventLoop/EventOwner.h>
 #include <Swiften/Base/SafeByteArray.h>
@@ -25,7 +26,7 @@ namespace boost {
 namespace Swift {
 	class EventLoop;
 
-	class BoostConnection : public Connection, public EventOwner, public boost::enable_shared_from_this<BoostConnection> {
+	class SWIFTEN_API BoostConnection : public Connection, public EventOwner, public boost::enable_shared_from_this<BoostConnection> {
 		public:
 			typedef boost::shared_ptr<BoostConnection> ref;
 
diff --git a/Swiften/Network/BoostConnectionServer.h b/Swiften/Network/BoostConnectionServer.h
index 56dc8bd..66af2a4 100644
--- a/Swiften/Network/BoostConnectionServer.h
+++ b/Swiften/Network/BoostConnectionServer.h
@@ -10,14 +10,15 @@
 #include <boost/asio/io_service.hpp>
 #include <boost/asio/ip/tcp.hpp>
 #include <boost/enable_shared_from_this.hpp>
-#include <Swiften/Base/boost_bsignals.h>
 
+#include <Swiften/Base/API.h>
+#include <Swiften/Base/boost_bsignals.h>
 #include <Swiften/Network/BoostConnection.h>
 #include <Swiften/Network/ConnectionServer.h>
 #include <Swiften/EventLoop/EventOwner.h>
 
 namespace Swift {
-	class BoostConnectionServer : public ConnectionServer, public EventOwner, public boost::enable_shared_from_this<BoostConnectionServer> {
+	class SWIFTEN_API BoostConnectionServer : public ConnectionServer, public EventOwner, public boost::enable_shared_from_this<BoostConnectionServer> {
 		public:
 			typedef boost::shared_ptr<BoostConnectionServer> ref;
 
diff --git a/Swiften/Network/BoostIOServiceThread.h b/Swiften/Network/BoostIOServiceThread.h
index 00fb397..d1a5f37 100644
--- a/Swiften/Network/BoostIOServiceThread.h
+++ b/Swiften/Network/BoostIOServiceThread.h
@@ -10,8 +10,10 @@
 #include <boost/thread/thread.hpp>
 #include <boost/shared_ptr.hpp>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
-	class BoostIOServiceThread {
+	class SWIFTEN_API BoostIOServiceThread {
 		public:
 			BoostIOServiceThread();
 			~BoostIOServiceThread();
diff --git a/Swiften/Network/BoostNetworkFactories.h b/Swiften/Network/BoostNetworkFactories.h
index c9b12da..1968acd 100644
--- a/Swiften/Network/BoostNetworkFactories.h
+++ b/Swiften/Network/BoostNetworkFactories.h
@@ -6,6 +6,7 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Network/NetworkFactories.h>
 #include <Swiften/Network/BoostIOServiceThread.h>
 
@@ -14,7 +15,7 @@ namespace Swift {
 	class NATTraverser;
 	class PlatformTLSFactories;
 
-	class BoostNetworkFactories : public NetworkFactories {
+	class SWIFTEN_API BoostNetworkFactories : public NetworkFactories {
 		public:
 			BoostNetworkFactories(EventLoop* eventLoop);
 			~BoostNetworkFactories();
diff --git a/Swiften/Network/ConnectionServer.h b/Swiften/Network/ConnectionServer.h
index 00703a4..e644d90 100644
--- a/Swiften/Network/ConnectionServer.h
+++ b/Swiften/Network/ConnectionServer.h
@@ -7,13 +7,14 @@
 #pragma once
 
 #include <boost/shared_ptr.hpp>
-#include <Swiften/Base/boost_bsignals.h>
 
+#include <Swiften/Base/API.h>
+#include <Swiften/Base/boost_bsignals.h>
 #include <Swiften/Network/Connection.h>
 #include <Swiften/Network/HostAddressPort.h>
 
 namespace Swift {
-	class ConnectionServer {
+	class SWIFTEN_API ConnectionServer {
 		public:
 			virtual ~ConnectionServer();
 
diff --git a/Swiften/Network/DomainNameResolver.h b/Swiften/Network/DomainNameResolver.h
index b0ebc35..491586a 100644
--- a/Swiften/Network/DomainNameResolver.h
+++ b/Swiften/Network/DomainNameResolver.h
@@ -7,15 +7,16 @@
 #pragma once
 
 #include <boost/shared_ptr.hpp>
-
 #include <string>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
 	class DomainNameServiceQuery;
 	class DomainNameAddressQuery;
 	
 
-	class DomainNameResolver {
+	class SWIFTEN_API DomainNameResolver {
 		public:
 			virtual ~DomainNameResolver();
 
diff --git a/Swiften/Network/HostAddress.h b/Swiften/Network/HostAddress.h
index 0b3bdda..621aa5d 100644
--- a/Swiften/Network/HostAddress.h
+++ b/Swiften/Network/HostAddress.h
@@ -8,8 +8,10 @@
 #include <string>
 #include <boost/asio/ip/address.hpp>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
-	class HostAddress {
+	class SWIFTEN_API HostAddress {
 		public:
 			HostAddress();
 			HostAddress(const std::string&);
diff --git a/Swiften/Network/HostAddressPort.h b/Swiften/Network/HostAddressPort.h
index e3c0413..68f3a1c 100644
--- a/Swiften/Network/HostAddressPort.h
+++ b/Swiften/Network/HostAddressPort.h
@@ -8,10 +8,11 @@
 
 #include <boost/asio/ip/tcp.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Network/HostAddress.h>
 
 namespace Swift {
-	class HostAddressPort {
+	class SWIFTEN_API HostAddressPort {
 		public:
 			HostAddressPort(const HostAddress& address = HostAddress(), int port = -1);
 			HostAddressPort(const boost::asio::ip::tcp::endpoint& endpoint);
diff --git a/Swiften/Network/PlatformDomainNameResolver.h b/Swiften/Network/PlatformDomainNameResolver.h
index 295ecc5..0617d9e 100644
--- a/Swiften/Network/PlatformDomainNameResolver.h
+++ b/Swiften/Network/PlatformDomainNameResolver.h
@@ -11,6 +11,7 @@
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition_variable.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Network/DomainNameResolver.h>
 #include <Swiften/Network/PlatformDomainNameQuery.h>
 #include <Swiften/Network/DomainNameServiceQuery.h>
@@ -20,7 +21,7 @@ namespace Swift {
 	
 	class EventLoop;
 
-	class PlatformDomainNameResolver : public DomainNameResolver {
+	class SWIFTEN_API PlatformDomainNameResolver : public DomainNameResolver {
 		public:
 			PlatformDomainNameResolver(EventLoop* eventLoop);
 			~PlatformDomainNameResolver();
diff --git a/Swiften/Parser/AttributeMap.h b/Swiften/Parser/AttributeMap.h
index 31df606..77b9c23 100644
--- a/Swiften/Parser/AttributeMap.h
+++ b/Swiften/Parser/AttributeMap.h
@@ -11,10 +11,11 @@
 #include <map>
 #include <boost/optional/optional_fwd.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Parser/Attribute.h>
 
 namespace Swift {
-	class AttributeMap {
+	class SWIFTEN_API AttributeMap {
 		public:
 			class Entry {
 				public:
diff --git a/Swiften/Parser/PayloadParser.h b/Swiften/Parser/PayloadParser.h
index 8a9a290..bb1ae3c 100644
--- a/Swiften/Parser/PayloadParser.h
+++ b/Swiften/Parser/PayloadParser.h
@@ -7,8 +7,10 @@
 #pragma once
 
 #include <boost/shared_ptr.hpp>
-#include <Swiften/Parser/AttributeMap.h>
 
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Parser/AttributeMap.h>
 #include <Swiften/Elements/Payload.h>
 
 namespace Swift {
@@ -22,7 +24,7 @@ namespace Swift {
 	 * After the data for the given top-level element is processed, getPayload() will be called to retrieve the
 	 * payload.
 	 */
-	class PayloadParser {
+	class SWIFTEN_API PayloadParser {
 		public:
 			virtual ~PayloadParser();
 
diff --git a/Swiften/Parser/PayloadParserFactory.h b/Swiften/Parser/PayloadParserFactory.h
index 5619d21..e265e5b 100644
--- a/Swiften/Parser/PayloadParserFactory.h
+++ b/Swiften/Parser/PayloadParserFactory.h
@@ -6,6 +6,7 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Parser/AttributeMap.h>
 
 namespace Swift {
@@ -15,7 +16,7 @@ namespace Swift {
 	/**
 	 * A factory for PayloadParsers.
 	 */
-	class PayloadParserFactory {
+	class SWIFTEN_API PayloadParserFactory {
 		public:
 			virtual ~PayloadParserFactory();
 
diff --git a/Swiften/Parser/PayloadParserFactoryCollection.h b/Swiften/Parser/PayloadParserFactoryCollection.h
index 6407641..1dbdd32 100644
--- a/Swiften/Parser/PayloadParserFactoryCollection.h
+++ b/Swiften/Parser/PayloadParserFactoryCollection.h
@@ -9,11 +9,12 @@
 #include <vector>
 
 #include <Swiften/Parser/AttributeMap.h>
+#include <Swiften/Base/API.h>
 
 namespace Swift {
 	class PayloadParserFactory;
 
-	class PayloadParserFactoryCollection {
+	class SWIFTEN_API PayloadParserFactoryCollection {
 		public:
 			PayloadParserFactoryCollection();
 
diff --git a/Swiften/Parser/PayloadParsers/DiscoInfoParser.h b/Swiften/Parser/PayloadParsers/DiscoInfoParser.h
index df1441c..1f93a88 100644
--- a/Swiften/Parser/PayloadParsers/DiscoInfoParser.h
+++ b/Swiften/Parser/PayloadParsers/DiscoInfoParser.h
@@ -6,11 +6,12 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/DiscoInfo.h>
 #include <Swiften/Parser/GenericPayloadParser.h>
 
 namespace Swift {
-	class DiscoInfoParser : public GenericPayloadParser<DiscoInfo> {
+	class SWIFTEN_API DiscoInfoParser : public GenericPayloadParser<DiscoInfo> {
 		public:
 			DiscoInfoParser();
 
diff --git a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h
index 46b692b..91302b1 100644
--- a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h
+++ b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h
@@ -9,11 +9,12 @@
 #include <boost/shared_ptr.hpp>
 #include <vector>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Parser/PayloadParserFactoryCollection.h>
 #include <Swiften/Parser/PayloadParserFactory.h>
 
 namespace Swift {
-	class FullPayloadParserFactoryCollection : public PayloadParserFactoryCollection {
+	class SWIFTEN_API FullPayloadParserFactoryCollection : public PayloadParserFactoryCollection {
 		public:
 			FullPayloadParserFactoryCollection();
 			~FullPayloadParserFactoryCollection();
diff --git a/Swiften/Parser/PayloadParsers/RosterParser.h b/Swiften/Parser/PayloadParsers/RosterParser.h
index c29064f..3b62f0b 100644
--- a/Swiften/Parser/PayloadParsers/RosterParser.h
+++ b/Swiften/Parser/PayloadParsers/RosterParser.h
@@ -6,13 +6,14 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/RosterPayload.h>
 #include <Swiften/Parser/GenericPayloadParser.h>
 
 namespace Swift {
 	class SerializingParser;
 
-	class RosterParser : public GenericPayloadParser<RosterPayload> {
+	class SWIFTEN_API RosterParser : public GenericPayloadParser<RosterPayload> {
 		public:
 			RosterParser();
 
diff --git a/Swiften/Parser/PayloadParsers/VCardParser.h b/Swiften/Parser/PayloadParsers/VCardParser.h
index 1475277..b1c47a3 100644
--- a/Swiften/Parser/PayloadParsers/VCardParser.h
+++ b/Swiften/Parser/PayloadParsers/VCardParser.h
@@ -9,10 +9,12 @@
 #include <Swiften/Elements/VCard.h>
 #include <Swiften/Parser/GenericPayloadParser.h>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
 	class SerializingParser;
 
-	class VCardParser : public GenericPayloadParser<VCard> {
+	class SWIFTEN_API VCardParser : public GenericPayloadParser<VCard> {
 		public:
 			VCardParser();
 
diff --git a/Swiften/Parser/PlatformXMLParserFactory.h b/Swiften/Parser/PlatformXMLParserFactory.h
index 16756ee..70355d0 100644
--- a/Swiften/Parser/PlatformXMLParserFactory.h
+++ b/Swiften/Parser/PlatformXMLParserFactory.h
@@ -7,9 +7,10 @@
 #pragma once
 
 #include <Swiften/Parser/XMLParserFactory.h>
+#include <Swiften/Base/API.h>
 
 namespace Swift {
-	class PlatformXMLParserFactory : public XMLParserFactory {
+	class SWIFTEN_API PlatformXMLParserFactory : public XMLParserFactory {
 		public:
 			PlatformXMLParserFactory();
 
diff --git a/Swiften/Parser/XMLParser.h b/Swiften/Parser/XMLParser.h
index 1b866e3..6ecc626 100644
--- a/Swiften/Parser/XMLParser.h
+++ b/Swiften/Parser/XMLParser.h
@@ -8,11 +8,12 @@
 
 #include <string>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
-	
 	class XMLParserClient;
 
-	class XMLParser {
+	class SWIFTEN_API XMLParser {
 		public:
 			XMLParser(XMLParserClient* client);
 			virtual ~XMLParser();
diff --git a/Swiften/Parser/XMLParserClient.h b/Swiften/Parser/XMLParserClient.h
index ff706a0..956eacf 100644
--- a/Swiften/Parser/XMLParserClient.h
+++ b/Swiften/Parser/XMLParserClient.h
@@ -4,15 +4,13 @@
  * See Documentation/Licenses/GPLv3.txt for more information.
  */
 
-#ifndef XMLPARSERCLIENT_H
-#define XMLPARSERCLIENT_H
+#pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Parser/AttributeMap.h>
 
 namespace Swift {
-	
-
-	class XMLParserClient {
+	class SWIFTEN_API XMLParserClient {
 		public:
 			virtual ~XMLParserClient();
 
@@ -21,5 +19,3 @@ namespace Swift {
 			virtual void handleCharacterData(const std::string& data) = 0;
 	};
 }
-
-#endif
diff --git a/Swiften/Parser/XMLParserFactory.h b/Swiften/Parser/XMLParserFactory.h
index 32665cb..6979ea4 100644
--- a/Swiften/Parser/XMLParserFactory.h
+++ b/Swiften/Parser/XMLParserFactory.h
@@ -6,11 +6,13 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
 	class XMLParser;
 	class XMLParserClient;
 
-	class XMLParserFactory {
+	class SWIFTEN_API XMLParserFactory {
 		public:
 			virtual ~XMLParserFactory();
 
diff --git a/Swiften/Parser/XMPPParser.h b/Swiften/Parser/XMPPParser.h
index 6cce2bd..757ee22 100644
--- a/Swiften/Parser/XMPPParser.h
+++ b/Swiften/Parser/XMPPParser.h
@@ -9,6 +9,7 @@
 #include <boost/shared_ptr.hpp>
 #include <boost/noncopyable.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Parser/XMLParserClient.h>
 #include <Swiften/Parser/AttributeMap.h>
 
@@ -19,7 +20,7 @@ namespace Swift {
 	class ElementParser;
 	class PayloadParserFactoryCollection;
 
-	class XMPPParser : public XMLParserClient, boost::noncopyable {
+	class SWIFTEN_API XMPPParser : public XMLParserClient, boost::noncopyable {
 		public:
 			XMPPParser(
 					XMPPParserClient* parserClient, 
diff --git a/Swiften/Parser/XMPPParserClient.h b/Swiften/Parser/XMPPParserClient.h
index e613f8e..85e0f86 100644
--- a/Swiften/Parser/XMPPParserClient.h
+++ b/Swiften/Parser/XMPPParserClient.h
@@ -8,13 +8,14 @@
 
 #include <boost/shared_ptr.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/Element.h>
 
 namespace Swift {
 	
 	class ProtocolHeader;
 
-	class XMPPParserClient {
+	class SWIFTEN_API XMPPParserClient {
 		public:
 			virtual ~XMPPParserClient();
 
diff --git a/Swiften/Presence/PresenceOracle.h b/Swiften/Presence/PresenceOracle.h
index 09126ea..fcf974f 100644
--- a/Swiften/Presence/PresenceOracle.h
+++ b/Swiften/Presence/PresenceOracle.h
@@ -11,11 +11,13 @@
 #include <string>
 #include <Swiften/Elements/Presence.h>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Base/boost_bsignals.h>
 
 namespace Swift {
-class StanzaChannel;
-	class PresenceOracle {
+	class StanzaChannel;
+
+	class SWIFTEN_API PresenceOracle {
 		public:
 			PresenceOracle(StanzaChannel* stanzaChannel);
 			~PresenceOracle();
diff --git a/Swiften/Presence/SubscriptionManager.h b/Swiften/Presence/SubscriptionManager.h
index efa3e1c..5fabb04 100644
--- a/Swiften/Presence/SubscriptionManager.h
+++ b/Swiften/Presence/SubscriptionManager.h
@@ -12,11 +12,12 @@
 #include <Swiften/JID/JID.h>
 #include <Swiften/Base/boost_bsignals.h>
 #include <Swiften/Elements/Presence.h>
+#include <Swiften/Base/API.h>
 
 namespace Swift {
 	class StanzaChannel;
 
-	class SubscriptionManager {
+	class SWIFTEN_API SubscriptionManager {
 		public:
 			SubscriptionManager(StanzaChannel* stanzaChannel);
 			~SubscriptionManager();
diff --git a/Swiften/Queries/GenericRequest.h b/Swiften/Queries/GenericRequest.h
index b9cc6fc..68c86c5 100644
--- a/Swiften/Queries/GenericRequest.h
+++ b/Swiften/Queries/GenericRequest.h
@@ -7,7 +7,6 @@
 #pragma once
 
 #include <Swiften/Base/boost_bsignals.h>
-
 #include <Swiften/Queries/Request.h>
 
 namespace Swift {
diff --git a/Swiften/Queries/GetResponder.h b/Swiften/Queries/GetResponder.h
index bca507a..213a52f 100644
--- a/Swiften/Queries/GetResponder.h
+++ b/Swiften/Queries/GetResponder.h
@@ -6,11 +6,12 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Queries/Responder.h>
 
 namespace Swift {
 	template<typename T>
-	class GetResponder : public Responder<T> {
+	class SWIFTEN_API GetResponder : public Responder<T> {
 		public:
 			GetResponder(IQRouter* router) : Responder<T>(router) {}
 
diff --git a/Swiften/Queries/IQHandler.h b/Swiften/Queries/IQHandler.h
index c9af5ea..19e16a7 100644
--- a/Swiften/Queries/IQHandler.h
+++ b/Swiften/Queries/IQHandler.h
@@ -8,12 +8,13 @@
 
 #include <boost/shared_ptr.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/IQ.h>
 
 namespace Swift {
 	class IQRouter;
 
-	class IQHandler {
+	class SWIFTEN_API IQHandler {
 		public:
 			virtual ~IQHandler();
 
diff --git a/Swiften/Queries/IQRouter.h b/Swiften/Queries/IQRouter.h
index de2822b..0655035 100644
--- a/Swiften/Queries/IQRouter.h
+++ b/Swiften/Queries/IQRouter.h
@@ -8,15 +8,16 @@
 
 #include <boost/shared_ptr.hpp>
 #include <vector>
-
 #include <string>
+
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/IQ.h>
 
 namespace Swift {
 	class IQChannel;
 	class IQHandler;
 
-	class IQRouter {
+	class SWIFTEN_API IQRouter {
 		public:
 			IQRouter(IQChannel* channel);
 			~IQRouter();
diff --git a/Swiften/Queries/Request.h b/Swiften/Queries/Request.h
index 668ed04..5e3a4b8 100644
--- a/Swiften/Queries/Request.h
+++ b/Swiften/Queries/Request.h
@@ -9,8 +9,9 @@
 #include <boost/shared_ptr.hpp>
 #include <boost/optional.hpp>
 #include <boost/enable_shared_from_this.hpp>
-
 #include <string>
+
+#include <Swiften/Base/API.h>
 #include <Swiften/Queries/IQHandler.h>
 #include <Swiften/Elements/IQ.h>
 #include <Swiften/Elements/Payload.h>
@@ -21,7 +22,7 @@ namespace Swift {
 	/**
 	 * An IQ get/set request query.
 	 */
-	class Request : public IQHandler, public boost::enable_shared_from_this<Request> {
+	class SWIFTEN_API Request : public IQHandler, public boost::enable_shared_from_this<Request> {
 		public:
 			void send();
 
diff --git a/Swiften/Queries/Responders/SoftwareVersionResponder.h b/Swiften/Queries/Responders/SoftwareVersionResponder.h
index a2929df..4957c0f 100644
--- a/Swiften/Queries/Responders/SoftwareVersionResponder.h
+++ b/Swiften/Queries/Responders/SoftwareVersionResponder.h
@@ -6,13 +6,14 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Queries/GetResponder.h>
 #include <Swiften/Elements/SoftwareVersion.h>
 
 namespace Swift {
 	class IQRouter;
 
-	class SoftwareVersionResponder : public GetResponder<SoftwareVersion> {
+	class SWIFTEN_API SoftwareVersionResponder : public GetResponder<SoftwareVersion> {
 		public:
 			SoftwareVersionResponder(IQRouter* router);
 
diff --git a/Swiften/Roster/RosterStorage.h b/Swiften/Roster/RosterStorage.h
index ba24cb3..7f0f20b 100644
--- a/Swiften/Roster/RosterStorage.h
+++ b/Swiften/Roster/RosterStorage.h
@@ -8,10 +8,11 @@
 
 #include <boost/shared_ptr.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/RosterPayload.h>
 
 namespace Swift {
-	class RosterStorage {
+	class SWIFTEN_API RosterStorage {
 		public:
 			virtual ~RosterStorage();
 
diff --git a/Swiften/SASL/PLAINMessage.h b/Swiften/SASL/PLAINMessage.h
index 46ee8f7..3811b31 100644
--- a/Swiften/SASL/PLAINMessage.h
+++ b/Swiften/SASL/PLAINMessage.h
@@ -9,10 +9,12 @@
 #pragma once
 
 #include <string>
+
+#include <Swiften/Base/API.h>
 #include <Swiften/Base/SafeByteArray.h>
 
 namespace Swift {
-	class PLAINMessage {
+	class SWIFTEN_API PLAINMessage {
 		public:
 			PLAINMessage(const std::string& authcid, const SafeByteArray& password, const std::string& authzid = "");
 			PLAINMessage(const SafeByteArray& value);
diff --git a/Swiften/SConscript b/Swiften/SConscript
index de67983..105a7f4 100644
--- a/Swiften/SConscript
+++ b/Swiften/SConscript
@@ -9,6 +9,7 @@ Import("env")
 swiften_dep_modules = ["BOOST", "GCONF", "ICU", "LIBIDN", "ZLIB", "OPENSSL", "LIBXML", "EXPAT", "AVAHI", "LIBMINIUPNPC", "LIBNATPMP"]
 
 if env["SCONS_STAGE"] == "flags" :
+	env["SWIFTEN_DLL"] = ARGUMENTS.get("swiften_dll")
 	env["SWIFTEN_VERSION"] = Version.getBuildVersion(env.Dir("#").abspath, "swift")
 	version_match = re.match("(\d+)\.(\d+).*", env["SWIFTEN_VERSION"])
 	if version_match :
@@ -22,9 +23,9 @@ if env["SCONS_STAGE"] == "flags" :
 	env["SWIFTEN_LIBRARY_FILE"] = "Swiften"
 	env["SWIFTEN_LIBRARY_ALIASES"] = []
 	
-	if ARGUMENTS.get("swiften_dll", False) :
+	if env["SWIFTEN_DLL"] :
 		if env["PLATFORM"] == "win32" :
-			pass
+			env["SWIFTEN_LIBRARY_FILE"] = "Swiften.dll"
 		elif env["PLATFORM"] == "darwin" :
 			env["SWIFTEN_LIBRARY_FILE"] = env.subst("Swiften.${SWIFTEN_VERSION_MAJOR}.${SWIFTEN_VERSION_MINOR}")
 			env["SWIFTEN_LIBRARY_ALIASES"] = ["libSwiften.dylib", env.subst("libSwiften.${SWIFTEN_VERSION_MAJOR}.dylib")]
@@ -35,6 +36,8 @@ if env["SCONS_STAGE"] == "flags" :
 	swiften_env = env.Clone()
 	swiften_env["LIBPATH"] = [Dir(".")]
 	swiften_env["LIBS"] = [swiften_env["SWIFTEN_LIBRARY"]]
+	if not env["SWIFTEN_DLL"] :
+		swiften_env["CPPDEFINES"] = ["SWIFTEN_STATIC"]
 	dep_env = env.Clone()
 	for module in swiften_dep_modules :
 		if env.get(module + "_BUNDLED", False) :
@@ -63,11 +66,12 @@ if env["SCONS_STAGE"] == "flags" :
 
 if env["SCONS_STAGE"] == "build" :
 	swiften_env = env.Clone()
+	swiften_env.Append(CPPDEFINES = ["SWIFTEN_BUILDING"])
 	for module in swiften_dep_modules :
 		swiften_env.UseFlags(swiften_env.get(module + "_FLAGS", {}))
 	swiften_env.UseFlags(swiften_env["PLATFORM_FLAGS"])
 	
-	if ARGUMENTS.get("swiften_dll", False) :
+	if swiften_env["SWIFTEN_DLL"] :
 		swiften_env.AddMethod(lambda e,s : e.SharedObject(s), "SwiftenObject")
 		swiften_env.AddMethod(lambda e,l,o : e.SharedLibrary(l,o), "SwiftenLibrary")
 	else :
@@ -233,7 +237,6 @@ if env["SCONS_STAGE"] == "build" :
 			"QA",
 		])
 
-
 	myenv = swiften_env.Clone()
 	if myenv["PLATFORM"] == "win32":
 		sources.append("StringCodecs/SHA1_Windows.cpp")
@@ -242,7 +245,7 @@ if env["SCONS_STAGE"] == "build" :
 
 	if myenv["PLATFORM"] != "darwin" and myenv["PLATFORM"] != "win32" and myenv.get("HAVE_GCONF", 0) :
 		env.MergeFlags(env["GCONF_FLAGS"])
-	if ARGUMENTS.get("swiften_dll", False) :
+	if myenv["SWIFTEN_DLL"] :
 		if myenv["PLATFORM"] == "posix" :
 			myenv.Append(LINKFLAGS = ["-Wl,-soname,libSwiften.so.$SWIFTEN_VERSION_MAJOR"])
 			myenv["SHLIBSUFFIX"] = ""
diff --git a/Swiften/Serializer/PayloadSerializer.h b/Swiften/Serializer/PayloadSerializer.h
index c4ad23b..46132fc 100644
--- a/Swiften/Serializer/PayloadSerializer.h
+++ b/Swiften/Serializer/PayloadSerializer.h
@@ -9,10 +9,12 @@
 #include <string>
 #include <boost/shared_ptr.hpp>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
 	class Payload;
 
-	class PayloadSerializer {
+	class SWIFTEN_API PayloadSerializer {
 		public:
 			virtual ~PayloadSerializer();
 
diff --git a/Swiften/Serializer/PayloadSerializerCollection.h b/Swiften/Serializer/PayloadSerializerCollection.h
index f922a45..78f8808 100644
--- a/Swiften/Serializer/PayloadSerializerCollection.h
+++ b/Swiften/Serializer/PayloadSerializerCollection.h
@@ -9,13 +9,14 @@
 #include <vector>
 #include <boost/shared_ptr.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/Payload.h>
 
 namespace Swift {
 	class PayloadSerializer;
 	
 
-	class PayloadSerializerCollection {
+	class SWIFTEN_API PayloadSerializerCollection {
 		public:
 			PayloadSerializerCollection();
 
diff --git a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h
index 3e028e1..233d752 100644
--- a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h
@@ -6,11 +6,12 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Serializer/GenericPayloadSerializer.h>
 #include <Swiften/Elements/DiscoInfo.h>
 
 namespace Swift {
-	class DiscoInfoSerializer : public GenericPayloadSerializer<DiscoInfo> {
+	class SWIFTEN_API DiscoInfoSerializer : public GenericPayloadSerializer<DiscoInfo> {
 		public:
 			DiscoInfoSerializer();
 
diff --git a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h
index 41e35a9..f41d585 100644
--- a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h
@@ -6,13 +6,14 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Serializer/GenericPayloadSerializer.h>
 #include <Swiften/Elements/ErrorPayload.h>
 
 namespace Swift {
 	class PayloadSerializerCollection;
 
-	class ErrorSerializer : public GenericPayloadSerializer<ErrorPayload> {
+	class SWIFTEN_API ErrorSerializer : public GenericPayloadSerializer<ErrorPayload> {
 		public:
 			ErrorSerializer(PayloadSerializerCollection* serializers);
 
diff --git a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h
index bfe7d76..eaae742 100644
--- a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h
+++ b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h
@@ -8,10 +8,11 @@
 
 #include <vector>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Serializer/PayloadSerializerCollection.h>
 
 namespace Swift {
-	class FullPayloadSerializerCollection : public PayloadSerializerCollection {
+	class SWIFTEN_API FullPayloadSerializerCollection : public PayloadSerializerCollection {
 		public:
 			FullPayloadSerializerCollection();
 			~FullPayloadSerializerCollection();
diff --git a/Swiften/Serializer/PayloadSerializers/RosterSerializer.h b/Swiften/Serializer/PayloadSerializers/RosterSerializer.h
index 52fdb2a..9e7ea1b 100644
--- a/Swiften/Serializer/PayloadSerializers/RosterSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/RosterSerializer.h
@@ -6,11 +6,12 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Serializer/GenericPayloadSerializer.h>
 #include <Swiften/Elements/RosterPayload.h>
 
 namespace Swift {
-	class RosterSerializer : public GenericPayloadSerializer<RosterPayload> {
+	class SWIFTEN_API RosterSerializer : public GenericPayloadSerializer<RosterPayload> {
 		public:
 			RosterSerializer();
 
diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.h b/Swiften/Serializer/PayloadSerializers/VCardSerializer.h
index c73ff18..04c1843 100644
--- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/VCardSerializer.h
@@ -9,8 +9,10 @@
 #include <Swiften/Serializer/GenericPayloadSerializer.h>
 #include <Swiften/Elements/VCard.h>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
-	class VCardSerializer : public GenericPayloadSerializer<VCard> {
+	class SWIFTEN_API VCardSerializer : public GenericPayloadSerializer<VCard> {
 		public:
 			VCardSerializer();
 
diff --git a/Swiften/Serializer/XML/XMLElement.h b/Swiften/Serializer/XML/XMLElement.h
index 6eacb82..305932a 100644
--- a/Swiften/Serializer/XML/XMLElement.h
+++ b/Swiften/Serializer/XML/XMLElement.h
@@ -12,10 +12,11 @@
 
 #include <string>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Serializer/XML/XMLNode.h>
 
 namespace Swift {
-	class XMLElement : public XMLNode {
+	class SWIFTEN_API XMLElement : public XMLNode {
 		public:
 			typedef boost::shared_ptr<XMLElement> ref;
 
diff --git a/Swiften/Serializer/XML/XMLNode.h b/Swiften/Serializer/XML/XMLNode.h
index d222faf..9d9e1a0 100644
--- a/Swiften/Serializer/XML/XMLNode.h
+++ b/Swiften/Serializer/XML/XMLNode.h
@@ -8,8 +8,10 @@
 
 #include <string>
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
-	class XMLNode {
+	class SWIFTEN_API XMLNode {
 		public:
 			virtual ~XMLNode();
 
diff --git a/Swiften/Session/Session.h b/Swiften/Session/Session.h
index c937430..4becebf 100644
--- a/Swiften/Session/Session.h
+++ b/Swiften/Session/Session.h
@@ -11,6 +11,7 @@
 #include <boost/optional.hpp>
 #include <boost/enable_shared_from_this.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/JID/JID.h>
 #include <Swiften/Elements/Element.h>
 #include <Swiften/Network/Connection.h>
@@ -27,7 +28,7 @@ namespace Swift {
 	class XMPPLayer;
 	class XMLParserFactory;
 
-	class Session : public boost::enable_shared_from_this<Session> {
+	class SWIFTEN_API Session : public boost::enable_shared_from_this<Session> {
 		public:
 			enum SessionError {
 				ConnectionReadError,
diff --git a/Swiften/StreamStack/XMPPLayer.h b/Swiften/StreamStack/XMPPLayer.h
index 81f0457..f0e88aa 100644
--- a/Swiften/StreamStack/XMPPLayer.h
+++ b/Swiften/StreamStack/XMPPLayer.h
@@ -10,6 +10,7 @@
 #include <Swiften/Base/boost_bsignals.h>
 #include <boost/noncopyable.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/StreamStack/HighLayer.h>
 #include <Swiften/Base/SafeByteArray.h>
 #include <Swiften/Elements/Element.h>
@@ -25,7 +26,7 @@ namespace Swift {
 	class XMLParserFactory;
 	class BOSHSessionStream;
 
-	class XMPPLayer : public XMPPParserClient, public HighLayer, boost::noncopyable {
+	class SWIFTEN_API XMPPLayer : public XMPPParserClient, public HighLayer, boost::noncopyable {
 		friend class BOSHSessionStream;
 		public:
 			XMPPLayer(
diff --git a/Swiften/StringCodecs/Base64.h b/Swiften/StringCodecs/Base64.h
index 2d67971..7d5ab51 100644
--- a/Swiften/StringCodecs/Base64.h
+++ b/Swiften/StringCodecs/Base64.h
@@ -7,13 +7,14 @@
 #pragma once
 
 #include <vector>
-
 #include <string>
+
+#include <Swiften/Base/API.h>
 #include <Swiften/Base/ByteArray.h>
 #include <Swiften/Base/SafeByteArray.h>
 
 namespace Swift {
-	class Base64 {
+	class SWIFTEN_API Base64 {
 		public:
 			static std::string encode(const ByteArray& s);
 			static SafeByteArray encode(const SafeByteArray& s);
diff --git a/Swiften/StringCodecs/Hexify.h b/Swiften/StringCodecs/Hexify.h
index c016448..3b9a751 100644
--- a/Swiften/StringCodecs/Hexify.h
+++ b/Swiften/StringCodecs/Hexify.h
@@ -6,10 +6,11 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Base/ByteArray.h>
 
 namespace Swift {
-	class Hexify {
+	class SWIFTEN_API Hexify {
 		public:
 			static std::string hexify(unsigned char byte);
 			static std::string hexify(const ByteArray& data);
diff --git a/Swiften/StringCodecs/SHA1.h b/Swiften/StringCodecs/SHA1.h
index 9edcbb2..30e757c 100644
--- a/Swiften/StringCodecs/SHA1.h
+++ b/Swiften/StringCodecs/SHA1.h
@@ -13,11 +13,12 @@
 #include <vector>
 #include <boost/cstdint.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Base/ByteArray.h>
 #include <Swiften/Base/SafeByteArray.h>
 
 namespace Swift {
-	class SHA1 {
+	class SWIFTEN_API SHA1 {
 		public:
 			SHA1();
 
diff --git a/Swiften/StringCodecs/SHA1_Windows.h b/Swiften/StringCodecs/SHA1_Windows.h
index a24779f..c485040 100644
--- a/Swiften/StringCodecs/SHA1_Windows.h
+++ b/Swiften/StringCodecs/SHA1_Windows.h
@@ -12,11 +12,11 @@
 #include <security.h>
 #include <Wincrypt.h>
 
-
+#include <Swiften/Base/API.h>
 #include <Swiften/Base/SafeByteArray.h>
 
 namespace Swift {
-	class SHA1 {
+	class SWIFTEN_API SHA1 {
 		public:
 			SHA1();
 			~SHA1();
diff --git a/Swiften/TLS/CAPICertificate.h b/Swiften/TLS/CAPICertificate.h
index 5f24b7e..aebfb41 100644
--- a/Swiften/TLS/CAPICertificate.h
+++ b/Swiften/TLS/CAPICertificate.h
@@ -6,6 +6,7 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Base/boost_bsignals.h>
 #include <Swiften/Base/SafeByteArray.h>
 #include <Swiften/TLS/CertificateWithKey.h>
@@ -21,7 +22,7 @@
 namespace Swift {
 	class TimerFactory;
 
-	class CAPICertificate : public Swift::CertificateWithKey {
+	class SWIFTEN_API CAPICertificate : public Swift::CertificateWithKey {
 		public:
 			CAPICertificate(const std::string& capiUri, TimerFactory* timerFactory);
 
diff --git a/Swiften/TLS/CertificateTrustChecker.h b/Swiften/TLS/CertificateTrustChecker.h
index 2ba6b40..4ec0b39 100644
--- a/Swiften/TLS/CertificateTrustChecker.h
+++ b/Swiften/TLS/CertificateTrustChecker.h
@@ -7,16 +7,17 @@
 #pragma once
 
 #include <boost/shared_ptr.hpp>
-
 #include <string>
-#include <Swiften/TLS/Certificate.h>
 #include <vector>
 
+#include <Swiften/Base/API.h>
+#include <Swiften/TLS/Certificate.h>
+
 namespace Swift {
 	/**
 	 * A class to implement a check for certificate trust.
 	 */
-	class CertificateTrustChecker {
+	class SWIFTEN_API CertificateTrustChecker {
 		public:
 			virtual ~CertificateTrustChecker();
 
diff --git a/Swiften/TLS/PlatformTLSFactories.h b/Swiften/TLS/PlatformTLSFactories.h
index 605db31..850d6f9 100644
--- a/Swiften/TLS/PlatformTLSFactories.h
+++ b/Swiften/TLS/PlatformTLSFactories.h
@@ -6,11 +6,13 @@
 
 #pragma once
 
+#include <Swiften/Base/API.h>
+
 namespace Swift {
 	class TLSContextFactory;
 	class CertificateFactory;
 
-	class PlatformTLSFactories {
+	class SWIFTEN_API PlatformTLSFactories {
 		public:
 			PlatformTLSFactories();
 			~PlatformTLSFactories();
diff --git a/Swiften/VCards/VCardManager.h b/Swiften/VCards/VCardManager.h
index 29fe32c..b7e3c32 100644
--- a/Swiften/VCards/VCardManager.h
+++ b/Swiften/VCards/VCardManager.h
@@ -8,6 +8,7 @@
 
 #include <set>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/JID/JID.h>
 #include <Swiften/Elements/VCard.h>
 #include <Swiften/Elements/ErrorPayload.h>
@@ -19,7 +20,7 @@ namespace Swift {
 	class VCardStorage;
 	class IQRouter;
 
-	class VCardManager : public boost::bsignals::trackable {
+	class SWIFTEN_API VCardManager : public boost::bsignals::trackable {
 		public:
 			VCardManager(const JID& ownJID, IQRouter* iqRouter, VCardStorage* vcardStorage);
 			~VCardManager();
diff --git a/Swiften/VCards/VCardStorage.h b/Swiften/VCards/VCardStorage.h
index 977a40c..5fba915 100644
--- a/Swiften/VCards/VCardStorage.h
+++ b/Swiften/VCards/VCardStorage.h
@@ -9,12 +9,13 @@
 #include <string>
 #include <boost/shared_ptr.hpp>
 
+#include <Swiften/Base/API.h>
 #include <Swiften/Elements/VCard.h>
 
 namespace Swift {
 	class JID;
 
-	class VCardStorage {
+	class SWIFTEN_API VCardStorage {
 		public:
 			virtual ~VCardStorage();
 
-- 
cgit v0.10.2-6-g49f6