From 01d390825a5d9ba37715b80cd0aa7aede022dcec Mon Sep 17 00:00:00 2001
From: Brad Kittenbrink <brad@lindenlab.com>
Date: Fri, 22 May 2009 23:27:16 +0000
Subject: [PATCH] DEV-27646 dll linkage for login module. Ok, finally got this
 to a point where it doesn't break the build and I can check in. llcommon can
 be built as a shared library (disabled but can be enabled with cmake cache
 var LLCOMMON_LINK_SHARED.

reviewed by Mani on tuesday (I still need to get his suggested changes
re-reviewed)
---
 indra/cmake/LLCommon.cmake                    |  5 ++
 indra/llcommon/CMakeLists.txt                 | 10 ++-
 indra/llcommon/linden_common.h                |  8 +-
 indra/llcommon/llapr.h                        | 22 ++---
 indra/llcommon/llassettype.h                  |  2 +-
 indra/llcommon/llbase32.h                     |  4 +-
 indra/llcommon/llbase64.h                     |  4 +-
 indra/llcommon/llcommon.h                     |  2 +-
 indra/llcommon/llcrc.h                        |  2 +-
 indra/llcommon/llcriticaldamp.h               |  2 +-
 indra/llcommon/llcursortypes.h                |  2 +-
 indra/llcommon/lldate.h                       |  2 +-
 indra/llcommon/llerror.h                      |  8 +-
 indra/llcommon/llerrorcontrol.h               | 48 +++++-----
 indra/llcommon/llerrorthread.h                |  2 +-
 indra/llcommon/llevent.h                      | 20 ++---
 indra/llcommon/lleventcoro.h                  | 12 +--
 indra/llcommon/lleventfilter.h                |  6 +-
 indra/llcommon/llevents.h                     | 12 +--
 indra/llcommon/llfasttimer.h                  |  4 +-
 indra/llcommon/llfile.h                       | 14 +--
 indra/llcommon/llfindlocale.h                 |  4 +-
 indra/llcommon/llfixedbuffer.h                |  2 +-
 indra/llcommon/llformat.h                     |  2 +-
 indra/llcommon/llframetimer.h                 |  2 +-
 indra/llcommon/llheartbeat.h                  |  2 +-
 indra/llcommon/llliveappconfig.h              |  2 +-
 indra/llcommon/lllivefile.h                   |  2 +-
 indra/llcommon/lllog.h                        |  4 +-
 indra/llcommon/llmd5.h                        |  2 +-
 indra/llcommon/llmemory.h                     |  2 +-
 indra/llcommon/llmemorystream.h               |  4 +-
 indra/llcommon/llmetrics.h                    |  4 +-
 indra/llcommon/llmortician.h                  |  2 +-
 indra/llcommon/llpreprocessor.h               | 41 ++++++---
 indra/llcommon/llqueuedthread.h               |  7 +-
 indra/llcommon/llrand.h                       | 12 +--
 indra/llcommon/llrefcount.h                   |  4 +-
 indra/llcommon/llrun.h                        |  6 +-
 indra/llcommon/llsd.h                         |  4 +-
 indra/llcommon/llsdserialize.h                | 18 ++--
 indra/llcommon/llsdutil.h                     | 58 +++----------
 indra/llcommon/llsecondlifeurls.h             | 30 +++----
 indra/llcommon/llsimplehash.h                 |  2 +-
 indra/llcommon/llstat.h                       | 16 ++--
 indra/llcommon/llstreamtools.h                | 36 ++++----
 indra/llcommon/llstring.h                     | 87 ++++++++++---------
 indra/llcommon/llstringtable.h                |  8 +-
 indra/llcommon/llsys.h                        | 18 ++--
 indra/llcommon/llthread.h                     | 16 ++--
 indra/llcommon/lltimer.h                      | 28 +++---
 indra/llcommon/lluri.h                        |  8 +-
 indra/llcommon/lluuid.h                       |  8 +-
 indra/llcommon/llworkerthread.h               |  4 +-
 indra/llcommon/metaclass.h                    |  8 +-
 indra/llcommon/metaproperty.h                 |  6 +-
 indra/llcommon/reflective.h                   |  4 +-
 indra/llcommon/tests/lleventcoro_test.cpp     |  3 +
 indra/llcommon/timing.h                       |  3 +-
 indra/llcommon/u64.h                          | 10 +--
 indra/llinventory/llparcel.cpp                |  2 +-
 indra/llmath/CMakeLists.txt                   |  1 +
 indra/llmath/llsdutil_math.cpp                |  2 +-
 indra/llmath/llsdutil_math.h                  | 70 +++++++++++++++
 indra/llmessage/llinstantmessage.cpp          |  2 +-
 indra/llmessage/llpartdata.cpp                |  2 +
 indra/llmessage/llregionpresenceverifier.cpp  |  2 +
 indra/llmessage/llsdmessagebuilder.cpp        |  1 +
 indra/llmessage/llsdmessagereader.cpp         |  1 +
 indra/llprimitive/llprimitive.cpp             |  2 +-
 indra/llprimitive/lltextureentry.cpp          |  2 +-
 indra/llrender/llgl.cpp                       |  2 -
 indra/llui/llfunctorregistry.cpp              |  1 +
 .../lscript_execute/llscriptresource.cpp      |  2 +
 indra/newview/llfeaturemanager.cpp            |  6 +-
 indra/newview/llfloaterabout.cpp              |  2 -
 indra/newview/llimview.cpp                    |  2 +-
 indra/newview/llpanelplace.cpp                |  1 +
 indra/newview/llstartup.cpp                   |  2 +-
 indra/newview/llviewerparcelmgr.cpp           |  1 +
 indra/newview/tests/llagentaccess_test.cpp    |  2 +
 indra/test/llsdmessagebuilder_tut.cpp         |  1 +
 indra/test/llsdmessagereader_tut.cpp          |  1 +
 indra/test/llsdutil_tut.cpp                   |  1 +
 84 files changed, 435 insertions(+), 346 deletions(-)
 create mode 100644 indra/llmath/llsdutil_math.h

diff --git a/indra/cmake/LLCommon.cmake b/indra/cmake/LLCommon.cmake
index 410766e4f94..e9e3784e699 100644
--- a/indra/cmake/LLCommon.cmake
+++ b/indra/cmake/LLCommon.cmake
@@ -13,3 +13,8 @@ set(LLCOMMON_INCLUDE_DIRS
     )
 
 set(LLCOMMON_LIBRARIES llcommon)
+
+set(LLCOMMON_LINK_SHARED OFF CACHE BOOL "Build the llcommon target as a shared library.")
+if(LLCOMMON_LINK_SHARED)
+    add_definitions(-DLL_COMMON_LINK_SHARED=1)
+endif(LLCOMMON_LINK_SHARED)
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 62476fd59d0..71ec6cb8e4a 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -5,6 +5,7 @@ project(llcommon)
 include(00-Common)
 include(LLAddBuildTest)
 include(LLCommon)
+include(Linking)
 include(Boost)
 
 include_directories(
@@ -215,13 +216,20 @@ set_source_files_properties(${llcommon_HEADER_FILES}
 
 list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES})
 
-add_library (llcommon ${llcommon_SOURCE_FILES})
+if(LLCOMMON_LINK_SHARED)
+    add_library (llcommon SHARED ${llcommon_SOURCE_FILES})
+    add_definitions(-DLL_COMMON_BUILD=1)
+else(LLCOMMON_LINK_SHARED)
+    add_library (llcommon ${llcommon_SOURCE_FILES})
+endif(LLCOMMON_LINK_SHARED)
+
 target_link_libraries(
     llcommon
     ${APRUTIL_LIBRARIES}
     ${APR_LIBRARIES}
     ${EXPAT_LIBRARIES}
     ${ZLIB_LIBRARIES}
+    ${WINDOWS_LIBRARIES}
     ${BOOST_PROGRAM_OPTIONS_LIBRARY}
     ${BOOST_REGEX_LIBRARY}
     )
diff --git a/indra/llcommon/linden_common.h b/indra/llcommon/linden_common.h
index 9adf24a4926..d0ab5e969f6 100644
--- a/indra/llcommon/linden_common.h
+++ b/indra/llcommon/linden_common.h
@@ -72,13 +72,7 @@
 #ifdef LL_WINDOWS
 // Reenable warnings we disabled above
 #pragma warning (3 : 4702) // unreachable code, we like level 3, not 4
-// level 4 warnings that we need to disable:
-#pragma warning (disable : 4100) // unreferenced formal parameter
-#pragma warning (disable : 4127) // conditional expression is constant (e.g. while(1) )
-#pragma warning (disable : 4244) // possible loss of data on conversions
-#pragma warning (disable : 4396) // the inline specifier cannot be used when a friend declaration refers to a specialization of a function template
-#pragma warning (disable : 4512) // assignment operator could not be generated
-#pragma warning (disable : 4706) // assignment within conditional (even if((x = y)) )
+// moved msvc warnings to llpreprocessor.h  *TODO - delete this comment after merge conflicts are unlikely -brad
 #endif	//	LL_WINDOWS
 
 // Linden only libs in alpha-order other than stdtypes.h
diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h
index 44ad2dd50f9..5bd4b8a0f0b 100644
--- a/indra/llcommon/llapr.h
+++ b/indra/llcommon/llapr.h
@@ -48,24 +48,24 @@
 #include "apr_atomic.h"
 #include "llstring.h"
 
-extern apr_thread_mutex_t* gLogMutexp;
+extern LL_COMMON_API apr_thread_mutex_t* gLogMutexp;
 
 /** 
  * @brief initialize the common apr constructs -- apr itself, the
  * global pool, and a mutex.
  */
-void ll_init_apr();
+void LL_COMMON_API ll_init_apr();
 
 /** 
  * @brief Cleanup those common apr constructs.
  */
-void ll_cleanup_apr();
+void LL_COMMON_API ll_cleanup_apr();
 
 //
 //LL apr_pool
 //manage apr_pool_t, destroy allocated apr_pool in the destruction function.
 //
-class LLAPRPool
+class LL_COMMON_API LLAPRPool
 {
 public:
 	LLAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE) ;
@@ -91,7 +91,7 @@ class LLAPRPool
 //which clears memory automatically.
 //so it can not hold static data or data after memory is cleared
 //
-class LLVolatileAPRPool : public LLAPRPool
+class LL_COMMON_API LLVolatileAPRPool : public LLAPRPool
 {
 public:
 	LLVolatileAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE);
@@ -117,7 +117,7 @@ class LLVolatileAPRPool : public LLAPRPool
  * destructor handles the unlock. Instances of this class are
  * <b>not</b> thread safe.
  */
-class LLScopedLock : private boost::noncopyable
+class LL_COMMON_API LLScopedLock : private boost::noncopyable
 {
 public:
 	/**
@@ -148,7 +148,7 @@ class LLScopedLock : private boost::noncopyable
 	apr_thread_mutex_t* mMutex;
 };
 
-template <typename Type> class LLAtomic32
+template <typename Type> class LL_COMMON_API LLAtomic32
 {
 public:
 	LLAtomic32<Type>() {};
@@ -191,7 +191,7 @@ typedef LLAtomic32<S32> LLAtomicS32;
 //      1, a temperary pool passed to an APRFile function, which is used within this function and only once.
 //      2, a global pool.
 //
-class LLAPRFile
+class LL_COMMON_API LLAPRFile
 {
 private:
 	apr_file_t* mFile ;
@@ -249,10 +249,10 @@ class LLAPRFile
  * APR_SUCCESS.
  * @return Returns <code>true</code> if status is an error condition.
  */
-bool ll_apr_warn_status(apr_status_t status);
+bool LL_COMMON_API ll_apr_warn_status(apr_status_t status);
 
-void ll_apr_assert_status(apr_status_t status);
+void LL_COMMON_API ll_apr_assert_status(apr_status_t status);
 
-extern "C" apr_pool_t* gAPRPoolp; // Global APR memory pool
+extern "C" LL_COMMON_API apr_pool_t* gAPRPoolp; // Global APR memory pool
 
 #endif // LL_LLAPR_H
diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h
index 0ee4ae28219..f9df6ddd92a 100644
--- a/indra/llcommon/llassettype.h
+++ b/indra/llcommon/llassettype.h
@@ -37,7 +37,7 @@
 
 #include "stdenums.h" 	// for EDragAndDropType
 
-class LLAssetType
+class LL_COMMON_API LLAssetType
 {
 public:
 	enum EType
diff --git a/indra/llcommon/llbase32.h b/indra/llcommon/llbase32.h
index 63a93e11ab5..0697f7b8e20 100644
--- a/indra/llcommon/llbase32.h
+++ b/indra/llcommon/llbase32.h
@@ -32,9 +32,9 @@
  */
 
 #ifndef LLBASE32_H
-#define LLBASE32_h
+#define LLBASE32_H
 
-class LLBase32
+class LL_COMMON_API LLBase32
 {
 public:
 	static std::string encode(const U8* input, size_t input_size);
diff --git a/indra/llcommon/llbase64.h b/indra/llcommon/llbase64.h
index 58414bba8bb..c48fea24783 100644
--- a/indra/llcommon/llbase64.h
+++ b/indra/llcommon/llbase64.h
@@ -32,9 +32,9 @@
  */
 
 #ifndef LLBASE64_H
-#define LLBASE64_h
+#define LLBASE64_H
 
-class LLBase64
+class LL_COMMON_API LLBase64
 {
 public:
 	static std::string encode(const U8* input, size_t input_size);
diff --git a/indra/llcommon/llcommon.h b/indra/llcommon/llcommon.h
index a1808e8a6c2..b36471f9f81 100644
--- a/indra/llcommon/llcommon.h
+++ b/indra/llcommon/llcommon.h
@@ -37,7 +37,7 @@
 #include "lltimer.h"
 #include "llfile.h"
 
-class LLCommon
+class LL_COMMON_API LLCommon
 {
 public:
 	static void initClass();
diff --git a/indra/llcommon/llcrc.h b/indra/llcommon/llcrc.h
index 27fae7d2697..74369062cc1 100644
--- a/indra/llcommon/llcrc.h
+++ b/indra/llcommon/llcrc.h
@@ -50,7 +50,7 @@
 //  llinfos << "File crc: " << crc.getCRC() << llendl;
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-class LLCRC
+class LL_COMMON_API LLCRC
 {
 protected:
 	U32 mCurrent;
diff --git a/indra/llcommon/llcriticaldamp.h b/indra/llcommon/llcriticaldamp.h
index ad98284a6c5..1ea5914b5b9 100644
--- a/indra/llcommon/llcriticaldamp.h
+++ b/indra/llcommon/llcriticaldamp.h
@@ -38,7 +38,7 @@
 
 #include "llframetimer.h"
 
-class LLCriticalDamp 
+class LL_COMMON_API LLCriticalDamp 
 {
 public:
 	LLCriticalDamp();
diff --git a/indra/llcommon/llcursortypes.h b/indra/llcommon/llcursortypes.h
index bea70351b77..836ecc3c047 100644
--- a/indra/llcommon/llcursortypes.h
+++ b/indra/llcommon/llcursortypes.h
@@ -77,6 +77,6 @@ enum ECursorType {
 	UI_CURSOR_COUNT			// Number of elements in this enum (NOT a cursor)
 };
 
-ECursorType getCursorFromString(const std::string& cursor_string);
+LL_COMMON_API ECursorType getCursorFromString(const std::string& cursor_string);
 
 #endif // LL_LLCURSORTYPES_H
diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h
index 29a9030b6d0..c096d7ddd5d 100644
--- a/indra/llcommon/lldate.h
+++ b/indra/llcommon/lldate.h
@@ -46,7 +46,7 @@
  *
  * The date class represents a point in time after epoch - 1970-01-01.
  */
-class LLDate
+class LL_COMMON_API LLDate
 {
 public:
 	/** 
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h
index 6794be49049..6ccdf2174b0 100644
--- a/indra/llcommon/llerror.h
+++ b/indra/llcommon/llerror.h
@@ -129,9 +129,9 @@ namespace LLError
 		They are not intended for general use.
 	*/
 	
-	class CallSite;
+	class LL_COMMON_API CallSite;
 	
-	class Log
+	class LL_COMMON_API Log
 	{
 	public:
 		static bool shouldLog(CallSite&);
@@ -140,7 +140,7 @@ namespace LLError
 		static void flush(std::ostringstream*, const CallSite&);
 	};
 	
-	class CallSite
+	class LL_COMMON_API CallSite
 	{
 		// Represents a specific place in the code where a message is logged
 		// This is public because it is used by the macros below.  It is not
@@ -189,7 +189,7 @@ namespace LLError
 	//LLCallStacks is designed not to be thread-safe.
    //so try not to use it in multiple parallel threads at same time.
    //Used in a single thread at a time is fine.
-   class LLCallStacks
+   class LL_COMMON_API LLCallStacks
    {
    private:
        static char**  sBuffer ;
diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h
index c9424f8a5ea..1a559ed7e02 100644
--- a/indra/llcommon/llerrorcontrol.h
+++ b/indra/llcommon/llerrorcontrol.h
@@ -52,12 +52,12 @@ class LLSD;
 
 namespace LLError
 {
-	void initForServer(const std::string& identity);
+	LL_COMMON_API void initForServer(const std::string& identity);
 		// resets all logging settings to defaults needed by server processes
 		// logs to stderr, syslog, and windows debug log
 		// the identity string is used for in the syslog
 
-	void initForApplication(const std::string& dir);
+	LL_COMMON_API void initForApplication(const std::string& dir);
 		// resets all logging settings to defaults needed by applicaitons
 		// logs to stderr and windows debug log
 		// sets up log configuration from the file logcontrol.xml in dir
@@ -68,13 +68,13 @@ namespace LLError
 		Setting a level means log messages at that level or above.
 	*/
 	
-	void setPrintLocation(bool);
-	void setDefaultLevel(LLError::ELevel);
-	void setFunctionLevel(const std::string& function_name, LLError::ELevel);
-	void setClassLevel(const std::string& class_name, LLError::ELevel);
-	void setFileLevel(const std::string& file_name, LLError::ELevel);
+	LL_COMMON_API void setPrintLocation(bool);
+	LL_COMMON_API void setDefaultLevel(LLError::ELevel);
+	LL_COMMON_API void setFunctionLevel(const std::string& function_name, LLError::ELevel);
+	LL_COMMON_API void setClassLevel(const std::string& class_name, LLError::ELevel);
+	LL_COMMON_API void setFileLevel(const std::string& file_name, LLError::ELevel);
 	
-	void configure(const LLSD&);
+	LL_COMMON_API void configure(const LLSD&);
 		// the LLSD can configure all of the settings
 		// usually read automatically from the live errorlog.xml file
 
@@ -84,21 +84,21 @@ namespace LLError
 	*/
 
 	typedef boost::function<void(const std::string&)> FatalFunction;
-	void crashAndLoop(const std::string& message);
+	LL_COMMON_API void crashAndLoop(const std::string& message);
 		// Default fatal function: access null pointer and loops forever
 
-	void setFatalFunction(const FatalFunction&);
+	LL_COMMON_API void setFatalFunction(const FatalFunction&);
 		// The fatal function will be called when an message of LEVEL_ERROR
 		// is logged.  Note: supressing a LEVEL_ERROR message from being logged
 		// (by, for example, setting a class level to LEVEL_NONE), will keep
 		// the that message from causing the fatal funciton to be invoked.
 
-    FatalFunction getFatalFunction();
+    LL_COMMON_API FatalFunction getFatalFunction();
         // Retrieve the previously-set FatalFunction
 
     /// temporarily override the FatalFunction for the duration of a
     /// particular scope, e.g. for unit tests
-    class OverrideFatalFunction
+    class LL_COMMON_API OverrideFatalFunction
     {
     public:
         OverrideFatalFunction(const FatalFunction& func):
@@ -116,15 +116,15 @@ namespace LLError
     };
 
 	typedef std::string (*TimeFunction)();
-	std::string utcTime();
+	LL_COMMON_API std::string utcTime();
 	
-	void setTimeFunction(TimeFunction);
+	LL_COMMON_API void setTimeFunction(TimeFunction);
 		// The function is use to return the current time, formatted for
 		// display by those error recorders that want the time included.
 
 
 
-	class Recorder
+	class LL_COMMON_API Recorder
 	{
 		// An object that handles the actual output or error messages.
 	public:
@@ -138,17 +138,17 @@ namespace LLError
 			// included in the text of the message
 	};
 	
-	void addRecorder(Recorder*);
-	void removeRecorder(Recorder*);
+	LL_COMMON_API void addRecorder(Recorder*);
+	LL_COMMON_API void removeRecorder(Recorder*);
 		// each error message is passed to each recorder via recordMessage()
 	
-	void logToFile(const std::string& filename);
-	void logToFixedBuffer(LLFixedBuffer*);
+	LL_COMMON_API void logToFile(const std::string& filename);
+	LL_COMMON_API void logToFixedBuffer(LLFixedBuffer*);
 		// Utilities to add recorders for logging to a file or a fixed buffer
 		// A second call to the same function will remove the logger added
 		// with the first.
 		// Passing the empty string or NULL to just removes any prior.
-	std::string logFileName();
+	LL_COMMON_API std::string logFileName();
 		// returns name of current logging file, empty string if none
 
 
@@ -157,11 +157,11 @@ namespace LLError
 	*/
 
 	class Settings;
-	Settings* saveAndResetSettings();
-	void restoreSettings(Settings *);
+	LL_COMMON_API Settings* saveAndResetSettings();
+	LL_COMMON_API void restoreSettings(Settings *);
 		
-	std::string abbreviateFile(const std::string& filePath);
-	int shouldLogCallCount();
+	LL_COMMON_API std::string abbreviateFile(const std::string& filePath);
+	LL_COMMON_API int shouldLogCallCount();
 	
 };
 
diff --git a/indra/llcommon/llerrorthread.h b/indra/llcommon/llerrorthread.h
index f1d6ffc34f5..3121d296754 100644
--- a/indra/llcommon/llerrorthread.h
+++ b/indra/llcommon/llerrorthread.h
@@ -35,7 +35,7 @@
 
 #include "llthread.h"
 
-class LLErrorThread : public LLThread
+class LL_COMMON_API LLErrorThread : public LLThread
 {
 public:
 	LLErrorThread();
diff --git a/indra/llcommon/llevent.h b/indra/llcommon/llevent.h
index 2cc8577219d..192cb84fea3 100644
--- a/indra/llcommon/llevent.h
+++ b/indra/llcommon/llevent.h
@@ -41,13 +41,13 @@
 namespace LLOldEvents
 {
 
-class LLEventListener;
-class LLEvent;
-class LLEventDispatcher;
-class LLObservable;
+class LL_COMMON_API LLEventListener;
+class LL_COMMON_API LLEvent;
+class LL_COMMON_API LLEventDispatcher;
+class LL_COMMON_API LLObservable;
 
 // Abstract event. All events derive from LLEvent
-class LLEvent : public LLThreadSafeRefCount
+class LL_COMMON_API LLEvent : public LLThreadSafeRefCount
 {
 protected:
 	virtual ~LLEvent();
@@ -75,7 +75,7 @@ class LLEvent : public LLThreadSafeRefCount
 };
 
 // Abstract listener. All listeners derive from LLEventListener
-class LLEventListener : public LLThreadSafeRefCount
+class LL_COMMON_API LLEventListener : public LLThreadSafeRefCount
 {
 protected:
 	virtual ~LLEventListener();
@@ -92,7 +92,7 @@ class LLEventListener : public LLThreadSafeRefCount
 };
 
 // A listener which tracks references to it and cleans up when it's deallocated
-class LLSimpleListener : public LLEventListener
+class LL_COMMON_API LLSimpleListener : public LLEventListener
 {
 public:
 	void clearDispatchers();
@@ -104,7 +104,7 @@ class LLSimpleListener : public LLEventListener
 	std::vector<LLEventDispatcher *> mDispatchers;
 };
 
-class LLObservable; // defined below
+class LL_COMMON_API LLObservable; // defined below
 
 // A structure which stores a Listener and its metadata
 struct LLListenerEntry
@@ -117,7 +117,7 @@ struct LLListenerEntry
 // Base class for a dispatcher - an object which listens
 // to events being fired and relays them to their
 // appropriate destinations.
-class LLEventDispatcher : public LLThreadSafeRefCount
+class LL_COMMON_API LLEventDispatcher : public LLThreadSafeRefCount
 {
 protected:
 	virtual ~LLEventDispatcher();
@@ -160,7 +160,7 @@ class LLEventDispatcher : public LLThreadSafeRefCount
 // In order for this class to work properly, it needs
 // an instance of an LLEventDispatcher to route events to their
 // listeners.
-class LLObservable
+class LL_COMMON_API LLObservable
 {
 public:
 	// Initialize with the default Dispatcher
diff --git a/indra/llcommon/lleventcoro.h b/indra/llcommon/lleventcoro.h
index 7232d1780f9..5726ea0f650 100644
--- a/indra/llcommon/lleventcoro.h
+++ b/indra/llcommon/lleventcoro.h
@@ -106,7 +106,7 @@ namespace LLEventDetail
      * that's okay, since it won't collide with any listener name used by the
      * earlier coroutine since that earlier coroutine no longer exists.
      */
-    std::string listenerNameForCoro(const void* self);
+    LL_COMMON_API std::string listenerNameForCoro(const void* self);
 
     /**
      * Implement behavior described for postAndWait()'s @a replyPumpNamePath
@@ -126,7 +126,7 @@ namespace LLEventDetail
      * In the degenerate case in which @a path is an empty array, @a dest will
      * @em become @a value rather than @em containing it.
      */
-    void storeToLLSDPath(LLSD& dest, const LLSD& path, const LLSD& value);
+    LL_COMMON_API void storeToLLSDPath(LLSD& dest, const LLSD& path, const LLSD& value);
 } // namespace LLEventDetail
 
 /**
@@ -378,7 +378,7 @@ LLSD errorException(const LLEventWithID& result, const std::string& desc);
  * because it's not an error in event processing: rather, this exception
  * announces an event that bears error information (for some other API).
  */
-class LLErrorEvent: public std::runtime_error
+class LL_COMMON_API LLErrorEvent: public std::runtime_error
 {
 public:
     LLErrorEvent(const std::string& what, const LLSD& data):
@@ -397,7 +397,7 @@ class LLErrorEvent: public std::runtime_error
  * Like errorException(), save that this trips a fatal error using LL_ERRS
  * rather than throwing an exception.
  */
-LLSD errorLog(const LLEventWithID& result, const std::string& desc);
+LL_COMMON_API LLSD errorLog(const LLEventWithID& result, const std::string& desc);
 
 /**
  * Certain event APIs require the name of an LLEventPump on which they should
@@ -413,7 +413,7 @@ LLSD errorLog(const LLEventWithID& result, const std::string& desc);
  * 4. Call your LLEventTempStream's wait() method to wait for the reply.
  * 5. Let the LLCoroEventPump go out of scope.
  */
-class LLCoroEventPump
+class LL_COMMON_API LLCoroEventPump
 {
 public:
     LLCoroEventPump(const std::string& name="coro"):
@@ -458,7 +458,7 @@ class LLCoroEventPump
  * success response, the other for error response. Extend LLCoroEventPump
  * for the two-pump use case.
  */
-class LLCoroEventPumps
+class LL_COMMON_API LLCoroEventPumps
 {
 public:
     LLCoroEventPumps(const std::string& name="coro",
diff --git a/indra/llcommon/lleventfilter.h b/indra/llcommon/lleventfilter.h
index fe1a631c6b5..89f0c7ea43c 100644
--- a/indra/llcommon/lleventfilter.h
+++ b/indra/llcommon/lleventfilter.h
@@ -20,7 +20,7 @@
 /**
  * Generic base class
  */
-class LLEventFilter: public LLEventStream
+class LL_COMMON_API LLEventFilter: public LLEventStream
 {
 public:
     /// construct a standalone LLEventFilter
@@ -60,7 +60,7 @@ class LLEventMatching: public LLEventFilter
  * @NOTE This is an abstract base class so that, for testing, we can use an
  * alternate "timer" that doesn't actually consume real time.
  */
-class LLEventTimeoutBase: public LLEventFilter
+class LL_COMMON_API LLEventTimeoutBase: public LLEventFilter
 {
 public:
     /// construct standalone
@@ -169,7 +169,7 @@ class LLEventTimeoutBase: public LLEventFilter
 };
 
 /// Production implementation of LLEventTimoutBase
-class LLEventTimeout: public LLEventTimeoutBase
+class LL_COMMON_API LLEventTimeout: public LLEventTimeoutBase
 {
 public:
     LLEventTimeout();
diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h
index 20061f09c61..e84d9a50ee0 100644
--- a/indra/llcommon/llevents.h
+++ b/indra/llcommon/llevents.h
@@ -125,7 +125,7 @@ typedef boost::signals2::scoped_connection LLTempBoundListener;
  * LLListenerOrPumpName::Empty. Test for this condition beforehand using
  * either <tt>if (param)</tt> or <tt>if (! param)</tt>.
  */
-class LLListenerOrPumpName
+class LL_COMMON_API LLListenerOrPumpName
 {
 public:
     /// passing string name of LLEventPump
@@ -172,13 +172,13 @@ class LLListenerOrPumpName
 /*****************************************************************************
 *   LLEventPumps
 *****************************************************************************/
-class LLEventPump;
+class LL_COMMON_API LLEventPump;
 
 /**
  * LLEventPumps is a Singleton manager through which one typically accesses
  * this subsystem.
  */
-class LLEventPumps: public LLSingleton<LLEventPumps>
+class LL_COMMON_API LLEventPumps: public LLSingleton<LLEventPumps>
 {
     friend class LLSingleton<LLEventPumps>;
 public:
@@ -307,7 +307,7 @@ typedef boost::signals2::trackable LLEventTrackable;
  * destruction. Please see LLEventTrackable documentation for situations in
  * which this may be perilous across threads.
  */
-class LLEventPump: public LLEventTrackable
+class LL_COMMON_API LLEventPump: public LLEventTrackable
 {
 public:
     /**
@@ -528,7 +528,7 @@ class LLEventPump: public LLEventTrackable
  * LLEventStream is a thin wrapper around LLStandardSignal. Posting an
  * event immediately calls all registered listeners.
  */
-class LLEventStream: public LLEventPump
+class LL_COMMON_API LLEventStream: public LLEventPump
 {
 public:
     LLEventStream(const std::string& name, bool tweak=false): LLEventPump(name, tweak) {}
@@ -545,7 +545,7 @@ class LLEventStream: public LLEventPump
  * LLEventQueue isa LLEventPump whose post() method defers calling registered
  * listeners until flush() is called.
  */
-class LLEventQueue: public LLEventPump
+class LL_COMMON_API LLEventQueue: public LLEventPump
 {
 public:
     LLEventQueue(const std::string& name, bool tweak=false): LLEventPump(name, tweak) {}
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h
index 94b51119e4e..f2dae09fdf7 100644
--- a/indra/llcommon/llfasttimer.h
+++ b/indra/llcommon/llfasttimer.h
@@ -35,9 +35,9 @@
 
 #define FAST_TIMER_ON 1
 
-U64 get_cpu_clock_count();
+U64 LL_COMMON_API get_cpu_clock_count();
 
-class LLFastTimer
+class LL_COMMON_API LLFastTimer
 {
 public:
 	enum EFastTimerType
diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h
index c6092f7b9c4..fea5d3ed2b8 100644
--- a/indra/llcommon/llfile.h
+++ b/indra/llcommon/llfile.h
@@ -70,7 +70,7 @@ typedef struct stat		llstat;
 
 #include "llstring.h" // safe char* -> std::string conversion
 
-class	LLFile
+class LL_COMMON_API LLFile
 {
 public:
 	// All these functions take UTF8 path/filenames.
@@ -95,7 +95,7 @@ class	LLFile
 
 #if USE_LLFILESTREAMS
 
-class	llifstream	:	public	std::basic_istream < char , std::char_traits < char > >
+class LL_COMMON_API llifstream	:	public	std::basic_istream < char , std::char_traits < char > >
 {
 	// input stream associated with a C stream
 public:
@@ -136,7 +136,7 @@ class	llifstream	:	public	std::basic_istream < char , std::char_traits < char >
 };
 
 
-class	llofstream	:	public	std::basic_ostream< char , std::char_traits < char > >
+class LL_COMMON_API llofstream	:	public	std::basic_ostream< char , std::char_traits < char > >
 {
 public:
 	typedef std::basic_ostream< char , std::char_traits < char > > _Myt;
@@ -185,7 +185,7 @@ class	llofstream	:	public	std::basic_ostream< char , std::char_traits < char > >
 //#define	llifstream	std::ifstream
 //#define	llofstream	std::ofstream
 
-class	llifstream	:	public	std::ifstream
+class LL_COMMON_API llifstream	:	public	std::ifstream
 {
 public:
 	llifstream() : std::ifstream()
@@ -203,7 +203,7 @@ class	llifstream	:	public	std::ifstream
 };
 
 
-class	llofstream	:	public	std::ofstream
+class LL_COMMON_API llofstream	:	public	std::ofstream
 {
 public:
 	llofstream() : std::ofstream()
@@ -231,7 +231,7 @@ class	llofstream	:	public	std::ofstream
  * and should only be used for config files and the like -- not in a
  * loop.
  */
-std::streamsize llifstream_size(llifstream& fstr);
-std::streamsize llofstream_size(llofstream& fstr);
+std::streamsize LL_COMMON_API llifstream_size(llifstream& fstr);
+std::streamsize LL_COMMON_API llofstream_size(llofstream& fstr);
 
 #endif // not LL_LLFILE_H
diff --git a/indra/llcommon/llfindlocale.h b/indra/llcommon/llfindlocale.h
index f17c7740f38..b812a065db7 100644
--- a/indra/llcommon/llfindlocale.h
+++ b/indra/llcommon/llfindlocale.h
@@ -59,8 +59,8 @@ typedef enum {
 /* This allocates/fills in a FL_Locale structure with pointers to
    strings (which should be treated as static), or NULL for inappropriate /
    undetected fields. */
-FL_Success FL_FindLocale(FL_Locale **locale, FL_Domain domain);
+LL_COMMON_API FL_Success FL_FindLocale(FL_Locale **locale, FL_Domain domain);
 /* This should be used to free the struct written by FL_FindLocale */
-void FL_FreeLocale(FL_Locale **locale);
+LL_COMMON_API void FL_FreeLocale(FL_Locale **locale);
 
 #endif /*__findlocale_h_*/
diff --git a/indra/llcommon/llfixedbuffer.h b/indra/llcommon/llfixedbuffer.h
index 992a024df1a..51d0701736e 100644
--- a/indra/llcommon/llfixedbuffer.h
+++ b/indra/llcommon/llfixedbuffer.h
@@ -41,7 +41,7 @@
 
 // Fixed size buffer for console output and other things.
 
-class LLFixedBuffer
+class LL_COMMON_API LLFixedBuffer
 {
 public:
 	LLFixedBuffer(const U32 max_lines = 20);
diff --git a/indra/llcommon/llformat.h b/indra/llcommon/llformat.h
index 44c62d97101..dc64edb26da 100644
--- a/indra/llcommon/llformat.h
+++ b/indra/llcommon/llformat.h
@@ -40,6 +40,6 @@
 // *NOTE: buffer limited to 1024, (but vsnprintf prevents overrun)
 // should perhaps be replaced with boost::format.
 
-std::string llformat(const char *fmt, ...);
+std::string LL_COMMON_API llformat(const char *fmt, ...);
 
 #endif // LL_LLFORMAT_H
diff --git a/indra/llcommon/llframetimer.h b/indra/llcommon/llframetimer.h
index 8f51272af24..be2d9b07034 100644
--- a/indra/llcommon/llframetimer.h
+++ b/indra/llcommon/llframetimer.h
@@ -43,7 +43,7 @@
 #include "lltimer.h"
 #include "timing.h"
 
-class LLFrameTimer 
+class LL_COMMON_API LLFrameTimer 
 {
 public:
 	LLFrameTimer() : mStartTime( sFrameTime ), mExpiry(0), mStarted(TRUE) {}
diff --git a/indra/llcommon/llheartbeat.h b/indra/llcommon/llheartbeat.h
index fecb5b1e546..6f7026970fe 100644
--- a/indra/llcommon/llheartbeat.h
+++ b/indra/llcommon/llheartbeat.h
@@ -40,7 +40,7 @@
 // Note: Win32 does not support the heartbeat/smackdown system;
 //   heartbeat-delivery turns into a no-op there.
 
-class LLHeartbeat
+class LL_COMMON_API LLHeartbeat
 {
 public:
 	// secs_between_heartbeat: after a heartbeat is successfully delivered,
diff --git a/indra/llcommon/llliveappconfig.h b/indra/llcommon/llliveappconfig.h
index 55d84a4778c..3251a7c50ea 100644
--- a/indra/llcommon/llliveappconfig.h
+++ b/indra/llcommon/llliveappconfig.h
@@ -37,7 +37,7 @@
 
 class LLApp;
 
-class LLLiveAppConfig : public LLLiveFile
+class LL_COMMON_API LLLiveAppConfig : public LLLiveFile
 {
 public:
 	// To use this, instantiate a LLLiveAppConfig object inside your main loop.
diff --git a/indra/llcommon/lllivefile.h b/indra/llcommon/lllivefile.h
index a3a9cf49abd..a6f9996767c 100644
--- a/indra/llcommon/lllivefile.h
+++ b/indra/llcommon/lllivefile.h
@@ -36,7 +36,7 @@
 const F32 configFileRefreshRate = 5.0; // seconds
 
 
-class LLLiveFile
+class LL_COMMON_API LLLiveFile
 {
 public:
 	LLLiveFile(const std::string &filename, const F32 refresh_period = 5.f);
diff --git a/indra/llcommon/lllog.h b/indra/llcommon/lllog.h
index 7ac6c8aa42a..b0ec570c018 100644
--- a/indra/llcommon/lllog.h
+++ b/indra/llcommon/lllog.h
@@ -39,9 +39,9 @@
 
 class LLLogImpl;
 class LLApp;
-class LLSD;
+class LL_COMMON_API LLSD;
 
-class LLLog
+class LL_COMMON_API LLLog
 {
 public:
 	LLLog(LLApp* app);
diff --git a/indra/llcommon/llmd5.h b/indra/llcommon/llmd5.h
index d8bca03e4ec..df9d7324ab6 100644
--- a/indra/llcommon/llmd5.h
+++ b/indra/llcommon/llmd5.h
@@ -80,7 +80,7 @@ const int MD5RAW_BYTES = 16;
 const int MD5HEX_STR_SIZE = 33;  // char hex[MD5HEX_STR_SIZE]; with null
 const int MD5HEX_STR_BYTES = 32; // message system fixed size
 
-class LLMD5 {
+class LL_COMMON_API LLMD5 {
 // first, some types:
   typedef unsigned       int uint4; // assumes integer is 4 words long
   typedef unsigned short int uint2; // assumes short integer is 2 words long
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index a72e58034bf..2c356db9654 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -38,7 +38,7 @@ extern S32 gTotalDAlloc;
 extern S32 gTotalDAUse;
 extern S32 gDACount;
 
-class LLMemory
+class LL_COMMON_API LLMemory
 {
 public:
 	static void initClass();
diff --git a/indra/llcommon/llmemorystream.h b/indra/llcommon/llmemorystream.h
index f3486324c57..fa0f5d22f2a 100644
--- a/indra/llcommon/llmemorystream.h
+++ b/indra/llcommon/llmemorystream.h
@@ -52,7 +52,7 @@
  * be careful to always pass in a valid memory location that exists
  * for at least as long as this streambuf.
  */
-class LLMemoryStreamBuf : public std::streambuf
+class LL_COMMON_API LLMemoryStreamBuf : public std::streambuf
 {
 public:
 	LLMemoryStreamBuf(const U8* start, S32 length);
@@ -74,7 +74,7 @@ class LLMemoryStreamBuf : public std::streambuf
  * be careful to always pass in a valid memory location that exists
  * for at least as long as this streambuf.
  */
-class LLMemoryStream : public std::istream
+class LL_COMMON_API LLMemoryStream : public std::istream
 {
 public:
 	LLMemoryStream(const U8* start, S32 length);
diff --git a/indra/llcommon/llmetrics.h b/indra/llcommon/llmetrics.h
index 1d91e8c8a28..11e10a5a2e8 100644
--- a/indra/llcommon/llmetrics.h
+++ b/indra/llcommon/llmetrics.h
@@ -36,9 +36,9 @@
 #define LL_LLMETRICS_H
 
 class LLMetricsImpl;
-class LLSD;
+class LL_COMMON_API LLSD;
 
-class LLMetrics
+class LL_COMMON_API LLMetrics
 {
 public:
 	LLMetrics();
diff --git a/indra/llcommon/llmortician.h b/indra/llcommon/llmortician.h
index fcda3df58e3..27bd8cd9b5c 100644
--- a/indra/llcommon/llmortician.h
+++ b/indra/llcommon/llmortician.h
@@ -35,7 +35,7 @@
 
 #include "stdtypes.h"
 
-class LLMortician 
+class LL_COMMON_API LLMortician 
 {
 public:
 	LLMortician() { mIsDead = FALSE; }
diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h
index 2e4fd4787a1..5ff7814997d 100644
--- a/indra/llcommon/llpreprocessor.h
+++ b/indra/llcommon/llpreprocessor.h
@@ -93,17 +93,6 @@
 #endif
 
 
-// Deal with the differeneces on Windows
-#if LL_MSVC
-namespace snprintf_hack
-{
-	int snprintf(char *str, size_t size, const char *format, ...);
-}
-
-// #define snprintf safe_snprintf		/* Flawfinder: ignore */
-using snprintf_hack::snprintf;
-#endif	// LL_MSVC
-
 // Static linking with apr on windows needs to be declared.
 #ifdef LL_WINDOWS
 #ifndef APR_DECLARE_STATIC
@@ -133,6 +122,36 @@ using snprintf_hack::snprintf;
 #pragma warning( disable : 4503 )	// 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation.
 #pragma warning( disable : 4800 )	// 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
 #pragma warning( disable : 4996 )	// warning: deprecated
+
+// level 4 warnings that we need to disable:
+#pragma warning (disable : 4100) // unreferenced formal parameter
+#pragma warning (disable : 4127) // conditional expression is constant (e.g. while(1) )
+#pragma warning (disable : 4244) // possible loss of data on conversions
+#pragma warning (disable : 4396) // the inline specifier cannot be used when a friend declaration refers to a specialization of a function template
+#pragma warning (disable : 4512) // assignment operator could not be generated
+#pragma warning (disable : 4706) // assignment within conditional (even if((x = y)) )
+
+#pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class
+#pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class
 #endif	//	LL_MSVC
 
+#if LL_WINDOWS
+#define LL_DLLEXPORT __declspec(dllexport)
+#define LL_DLLIMPORT __declspec(dllimport)
+#else
+#define LL_DLLEXPORT
+#define LL_DLLIMPORT
+#endif // LL_WINDOWS
+
+
+#if LL_COMMON_LINK_SHARED
+# if LL_COMMON_BUILD
+#   define LL_COMMON_API LL_DLLEXPORT
+# else //LL_COMMON_BUILD
+#   define LL_COMMON_API LL_DLLIMPORT
+# endif //LL_COMMON_BUILD
+#else // LL_COMMON_LINK_SHARED
+# define LL_COMMON_API
+#endif // LL_COMMON_LINK_SHARED
+
 #endif	//	not LL_LINDEN_PREPROCESSOR_H
diff --git a/indra/llcommon/llqueuedthread.h b/indra/llcommon/llqueuedthread.h
index 3ba43e1e070..b3cde22b409 100644
--- a/indra/llcommon/llqueuedthread.h
+++ b/indra/llcommon/llqueuedthread.h
@@ -47,7 +47,7 @@
 // Note: ~LLQueuedThread is O(N) N=# of queued threads, assumed to be small
 //   It is assumed that LLQueuedThreads are rarely created/destroyed.
 
-class LLQueuedThread : public LLThread
+class LL_COMMON_API LLQueuedThread : public LLThread
 {
 	//------------------------------------------------------------------------
 public:
@@ -80,7 +80,7 @@ class LLQueuedThread : public LLThread
 	//------------------------------------------------------------------------
 public:
 
-	class QueuedRequest : public LLSimpleHashEntry<handle_t>
+	class LL_COMMON_API QueuedRequest : public LLSimpleHashEntry<handle_t>
 	{
 		friend class LLQueuedThread;
 		
@@ -148,6 +148,9 @@ class LLQueuedThread : public LLThread
 		}
 	};
 
+    template class LL_COMMON_API std::set<QueuedRequest*, queued_request_less>;
+
+
 	//------------------------------------------------------------------------
 	
 public:
diff --git a/indra/llcommon/llrand.h b/indra/llcommon/llrand.h
index d12597bb53e..30fec9b982b 100644
--- a/indra/llcommon/llrand.h
+++ b/indra/llcommon/llrand.h
@@ -65,32 +65,32 @@
 /**
  *@brief Generate a float from [0, RAND_MAX).
  */
-S32 ll_rand();
+S32 LL_COMMON_API ll_rand();
 
 /**
  *@brief Generate a float from [0, val) or (val, 0].
  */
-S32 ll_rand(S32 val);
+S32 LL_COMMON_API ll_rand(S32 val);
 
 /**
  *@brief Generate a float from [0, 1.0).
  */
-F32 ll_frand();
+F32 LL_COMMON_API ll_frand();
 
 /**
  *@brief Generate a float from [0, val) or (val, 0].
  */
-F32 ll_frand(F32 val);
+F32 LL_COMMON_API ll_frand(F32 val);
 
 /**
  *@brief Generate a double from [0, 1.0).
  */
-F64 ll_drand();
+F64 LL_COMMON_API ll_drand();
 
 /**
  *@brief Generate a double from [0, val) or (val, 0].
  */
-F64 ll_drand(F64 val);
+F64 LL_COMMON_API ll_drand(F64 val);
 
 /**
  * @brief typedefs for good boost lagged fibonacci.
diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h
index 540a18b8a0b..5f102509fd7 100644
--- a/indra/llcommon/llrefcount.h
+++ b/indra/llcommon/llrefcount.h
@@ -37,9 +37,9 @@
 // see llthread.h for LLThreadSafeRefCount
 //----------------------------------------------------------------------------
 
-class LLRefCount
+class LL_COMMON_API LLRefCount
 {
-protected:
+private:
 	LLRefCount(const LLRefCount&); // not implemented
 private:
 	LLRefCount&operator=(const LLRefCount&); // not implemented
diff --git a/indra/llcommon/llrun.h b/indra/llcommon/llrun.h
index 77b23d9051f..afe65fd734e 100644
--- a/indra/llcommon/llrun.h
+++ b/indra/llcommon/llrun.h
@@ -38,7 +38,7 @@
 #include <vector>
 #include <boost/shared_ptr.hpp>
 
-class LLRunnable;
+class LL_COMMON_API LLRunnable;
 
 /** 
  * @class LLRunner
@@ -48,7 +48,7 @@ class LLRunnable;
  * which are scheduled to run on a repeating or one time basis.
  * @see LLRunnable
  */
-class LLRunner
+class LL_COMMON_API LLRunner
 {
 public:
 	/**
@@ -149,7 +149,7 @@ class LLRunner
  * something useful.
  * @see LLRunner
  */
-class LLRunnable
+class LL_COMMON_API LLRunnable
 {
 public:
 	LLRunnable();
diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h
index d2845a3757e..552bb57498e 100644
--- a/indra/llcommon/llsd.h
+++ b/indra/llcommon/llsd.h
@@ -89,7 +89,7 @@
 	@nosubgrouping
 */
 
-class LLSD
+class LL_COMMON_API LLSD
 {
 public:
 		LLSD();		///< initially Undefined
@@ -387,7 +387,7 @@ struct llsd_select_string : public std::unary_function<LLSD, LLSD::String>
 	}
 };
 
-std::ostream& operator<<(std::ostream& s, const LLSD& llsd);
+LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLSD& llsd);
 
 /** QUESTIONS & TO DOS
 	- Would Binary be more convenient as usigned char* buffer semantics?
diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h
index 7463d1e5ddd..4b32f0afcda 100644
--- a/indra/llcommon/llsdserialize.h
+++ b/indra/llcommon/llsdserialize.h
@@ -44,7 +44,7 @@
  * @class LLSDParser
  * @brief Abstract base class for LLSD parsers.
  */
-class LLSDParser : public LLRefCount
+class LL_COMMON_API LLSDParser : public LLRefCount
 {
 protected:
 	/** 
@@ -221,7 +221,7 @@ class LLSDParser : public LLRefCount
  * @class LLSDNotationParser
  * @brief Parser which handles the original notation format for LLSD.
  */
-class LLSDNotationParser : public LLSDParser
+class LL_COMMON_API LLSDNotationParser : public LLSDParser
 {
 protected:
 	/** 
@@ -294,7 +294,7 @@ class LLSDNotationParser : public LLSDParser
  * @class LLSDXMLParser
  * @brief Parser which handles XML format LLSD.
  */
-class LLSDXMLParser : public LLSDParser
+class LL_COMMON_API LLSDXMLParser : public LLSDParser
 {
 protected:
 	/** 
@@ -342,7 +342,7 @@ class LLSDXMLParser : public LLSDParser
  * @class LLSDBinaryParser
  * @brief Parser which handles binary formatted LLSD.
  */
-class LLSDBinaryParser : public LLSDParser
+class LL_COMMON_API LLSDBinaryParser : public LLSDParser
 {
 protected:
 	/** 
@@ -407,7 +407,7 @@ class LLSDBinaryParser : public LLSDParser
  * @class LLSDFormatter
  * @brief Abstract base class for formatting LLSD.
  */
-class LLSDFormatter : public LLRefCount
+class LL_COMMON_API LLSDFormatter : public LLRefCount
 {
 protected:
 	/** 
@@ -479,7 +479,7 @@ class LLSDFormatter : public LLRefCount
  * @class LLSDNotationFormatter
  * @brief Formatter which outputs the original notation format for LLSD.
  */
-class LLSDNotationFormatter : public LLSDFormatter
+class LL_COMMON_API LLSDNotationFormatter : public LLSDFormatter
 {
 protected:
 	/** 
@@ -520,7 +520,7 @@ class LLSDNotationFormatter : public LLSDFormatter
  * @class LLSDXMLFormatter
  * @brief Formatter which outputs the LLSD as XML.
  */
-class LLSDXMLFormatter : public LLSDFormatter
+class LL_COMMON_API LLSDXMLFormatter : public LLSDFormatter
 {
 protected:
 	/** 
@@ -588,7 +588,7 @@ class LLSDXMLFormatter : public LLSDFormatter
  * Map: '{' + 4 byte integer size  every(key + value) + '}'<br>
  *  map keys are serialized as 'k' + 4 byte integer size + string
  */
-class LLSDBinaryFormatter : public LLSDFormatter
+class LL_COMMON_API LLSDBinaryFormatter : public LLSDFormatter
 {
 protected:
 	/** 
@@ -677,7 +677,7 @@ typedef LLSDOStreamer<LLSDXMLFormatter>			LLSDXMLStreamer;
  * @class LLSDSerialize
  * @brief Serializer / deserializer for the various LLSD formats
  */
-class LLSDSerialize
+class LL_COMMON_API LLSDSerialize
 {
 public:
 	enum ELLSD_Serialize
diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h
index 0752f8aff1d..a4175be4508 100644
--- a/indra/llcommon/llsdutil.h
+++ b/indra/llcommon/llsdutil.h
@@ -35,62 +35,32 @@
 #ifndef LL_LLSDUTIL_H
 #define LL_LLSDUTIL_H
 
-#include "llsd.h"
-
-// vector3
-class LLVector3;
-LLSD ll_sd_from_vector3(const LLVector3& vec);
-LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index = 0);
-
-// vector4
-class LLVector4;
-LLSD ll_sd_from_vector4(const LLVector4& vec);
-LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index = 0);
-
-// vector3d (double)
-class LLVector3d;
-LLSD ll_sd_from_vector3d(const LLVector3d& vec);
-LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index = 0);
-
-// vector2
-class LLVector2;
-LLSD ll_sd_from_vector2(const LLVector2& vec);
-LLVector2 ll_vector2_from_sd(const LLSD& sd);
-
-// Quaternion
-class LLQuaternion;
-LLSD ll_sd_from_quaternion(const LLQuaternion& quat);
-LLQuaternion ll_quaternion_from_sd(const LLSD& sd);
-
-// color4
-class LLColor4;
-LLSD ll_sd_from_color4(const LLColor4& c);
-LLColor4 ll_color4_from_sd(const LLSD& sd);
+class LL_COMMON_API LLSD;
 
 // U32
-LLSD ll_sd_from_U32(const U32);
-U32 ll_U32_from_sd(const LLSD& sd);
+LL_COMMON_API LLSD ll_sd_from_U32(const U32);
+LL_COMMON_API U32 ll_U32_from_sd(const LLSD& sd);
 
 // U64
-LLSD ll_sd_from_U64(const U64);
-U64 ll_U64_from_sd(const LLSD& sd);
+LL_COMMON_API LLSD ll_sd_from_U64(const U64);
+LL_COMMON_API U64 ll_U64_from_sd(const LLSD& sd);
 
 // IP Address
-LLSD ll_sd_from_ipaddr(const U32);
-U32 ll_ipaddr_from_sd(const LLSD& sd);
+LL_COMMON_API LLSD ll_sd_from_ipaddr(const U32);
+LL_COMMON_API U32 ll_ipaddr_from_sd(const LLSD& sd);
 
 // Binary to string
-LLSD ll_string_from_binary(const LLSD& sd);
+LL_COMMON_API LLSD ll_string_from_binary(const LLSD& sd);
 
 //String to binary
-LLSD ll_binary_from_string(const LLSD& sd);
+LL_COMMON_API LLSD ll_binary_from_string(const LLSD& sd);
 
 // Serializes sd to static buffer and returns pointer, useful for gdb debugging.
-char* ll_print_sd(const LLSD& sd);
+LL_COMMON_API char* ll_print_sd(const LLSD& sd);
 
 // Serializes sd to static buffer and returns pointer, using "pretty printing" mode.
-char* ll_pretty_print_sd_ptr(const LLSD* sd);
-char* ll_pretty_print_sd(const LLSD& sd);
+LL_COMMON_API char* ll_pretty_print_sd_ptr(const LLSD* sd);
+LL_COMMON_API char* ll_pretty_print_sd(const LLSD& sd);
 
 //compares the structure of an LLSD to a template LLSD and stores the
 //"valid" values in a 3rd LLSD. Default values
@@ -99,7 +69,7 @@ char* ll_pretty_print_sd(const LLSD& sd);
 //Returns false if the test is of same type but values differ in type
 //Otherwise, returns true
 
-BOOL compare_llsd_with_template(
+LL_COMMON_API BOOL compare_llsd_with_template(
 	const LLSD& llsd_to_test,
 	const LLSD& template_llsd,
 	LLSD& resultant_llsd);
@@ -157,7 +127,7 @@ BOOL compare_llsd_with_template(
  * meaningfully converted to the requested type. The same goes for UUID, Date
  * and URI.
  */
-std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::string& pfx="");
+LL_COMMON_API std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::string& pfx="");
 
 // Simple function to copy data out of input & output iterators if
 // there is no need for casting.
diff --git a/indra/llcommon/llsecondlifeurls.h b/indra/llcommon/llsecondlifeurls.h
index a2e5f0b9c60..bd2f9f76043 100644
--- a/indra/llcommon/llsecondlifeurls.h
+++ b/indra/llcommon/llsecondlifeurls.h
@@ -34,49 +34,49 @@
 #define LL_LLSECONDLIFEURLS_H
 /*
 // Account registration web page
-extern const std::string CREATE_ACCOUNT_URL;
+LL_COMMON_API extern const std::string CREATE_ACCOUNT_URL;
 
 // Manage Account
-extern const std::string MANAGE_ACCOUNT;
+LL_COMMON_API extern const std::string MANAGE_ACCOUNT;
 
-extern const std::string AUCTION_URL; 
+LL_COMMON_API extern const std::string AUCTION_URL; 
 
-extern const std::string EVENTS_URL;
+LL_COMMON_API extern const std::string EVENTS_URL;
 */
 // Tier up to a new land level.
-extern const std::string TIER_UP_URL;
+LL_COMMON_API extern const std::string TIER_UP_URL;
 
 
 // Tier up to a new land level.
-extern const std::string LAND_URL;
+LL_COMMON_API extern const std::string LAND_URL;
 
 // How to get DirectX 9
-extern const std::string DIRECTX_9_URL;
+LL_COMMON_API extern const std::string DIRECTX_9_URL;
 
 /*
 // Upgrade from basic membership to premium membership
-extern const std::string UPGRADE_TO_PREMIUM_URL;
+LL_COMMON_API extern const std::string UPGRADE_TO_PREMIUM_URL;
 
 
 // Out of date VIA chipset
-extern const std::string VIA_URL;
+LL_COMMON_API extern const std::string VIA_URL;
 
 // Support URL
-extern const std::string SUPPORT_URL;
+LL_COMMON_API extern const std::string SUPPORT_URL;
 
 // Linden Blogs page
-extern const std::string BLOGS_URL;
+LL_COMMON_API extern const std::string BLOGS_URL;
 
 // Currency page
-extern const std::string BUY_CURRENCY_URL;
+LL_COMMON_API extern const std::string BUY_CURRENCY_URL;
 
 // LSL script wiki
-extern const std::string LSL_DOC_URL;
+LL_COMMON_API extern const std::string LSL_DOC_URL;
 
 // SL KnowledgeBase page
-extern const std::string SL_KB_URL;
+LL_COMMON_API extern const std::string SL_KB_URL;
 
 // Release Notes Redirect URL for Server and Viewer
-extern const std::string RELEASE_NOTES_BASE_URL;
+LL_COMMON_API extern const std::string RELEASE_NOTES_BASE_URL;
 */
 #endif
diff --git a/indra/llcommon/llsimplehash.h b/indra/llcommon/llsimplehash.h
index 0ba2a3014c7..5df93b646ec 100644
--- a/indra/llcommon/llsimplehash.h
+++ b/indra/llcommon/llsimplehash.h
@@ -64,7 +64,7 @@ class LLSimpleHashEntry
 };
 
 template <typename HASH_KEY_TYPE, int TABLE_SIZE>
-class LLSimpleHash
+class LL_COMMON_API LLSimpleHash
 {
 public:
 	LLSimpleHash()
diff --git a/indra/llcommon/llstat.h b/indra/llcommon/llstat.h
index bad18f46a0a..5d77215bebb 100644
--- a/indra/llcommon/llstat.h
+++ b/indra/llcommon/llstat.h
@@ -40,7 +40,7 @@
 #include "llframetimer.h"
 #include "llfile.h"
 
-class	LLSD;
+class	LL_COMMON_API LLSD;
 
 // Set this if longer stats are needed
 #define ENABLE_LONG_TIME_STATS	0
@@ -52,7 +52,7 @@ class	LLSD;
 // amounts of time with very low memory cost.
 //
 
-class LLStatAccum
+class LL_COMMON_API LLStatAccum
 {
 protected:
 	LLStatAccum(bool use_frame_timer);
@@ -116,7 +116,7 @@ class LLStatAccum
 	F64 	mLastSampleValue;
 };
 
-class LLStatMeasure : public LLStatAccum
+class LL_COMMON_API LLStatMeasure : public LLStatAccum
 	// gathers statistics about things that are measured
 	// ex.: tempature, time dilation
 {
@@ -131,7 +131,7 @@ class LLStatMeasure : public LLStatAccum
 };
 
 
-class LLStatRate : public LLStatAccum
+class LL_COMMON_API LLStatRate : public LLStatAccum
 	// gathers statistics about things that can be counted over time
 	// ex.: LSL instructions executed, messages sent, simulator frames completed
 	// renders it in terms of rate of thing per second
@@ -147,7 +147,7 @@ class LLStatRate : public LLStatAccum
 };
 
 
-class LLStatTime : public LLStatAccum
+class LL_COMMON_API LLStatTime : public LLStatAccum
 	// gathers statistics about time spent in a block of code
 	// measure average duration per second in the block
 {
@@ -178,7 +178,7 @@ class LLStatTime : public LLStatAccum
 
 
 // Use this class on the stack to record statistics about an area of code
-class LLPerfBlock
+class LL_COMMON_API LLPerfBlock
 {
 public:
     struct StatEntry
@@ -220,7 +220,7 @@ class LLPerfBlock
 
 // ----------------------------------------------------------------------------
 
-class LLPerfStats
+class LL_COMMON_API LLPerfStats
 {
 public:
     LLPerfStats(const std::string& process_name = "unknown", S32 process_pid = 0);
@@ -256,7 +256,7 @@ class LLPerfStats
 };
 
 // ----------------------------------------------------------------------------
-class LLStat
+class LL_COMMON_API LLStat
 {
 private:
 	typedef std::multimap<std::string, LLStat*> stat_map_t;
diff --git a/indra/llcommon/llstreamtools.h b/indra/llcommon/llstreamtools.h
index a6dc4d51e27..f64e7614093 100644
--- a/indra/llcommon/llstreamtools.h
+++ b/indra/llcommon/llstreamtools.h
@@ -39,23 +39,23 @@
 // unless specifed otherwise these all return input_stream.good()
 
 // skips spaces and tabs
-bool skip_whitespace(std::istream& input_stream);
+LL_COMMON_API bool skip_whitespace(std::istream& input_stream);
 
 // skips whitespace and newlines
-bool skip_emptyspace(std::istream& input_stream);
+LL_COMMON_API bool skip_emptyspace(std::istream& input_stream);
 
 // skips emptyspace and lines that start with a #
-bool skip_comments_and_emptyspace(std::istream& input_stream);
+LL_COMMON_API bool skip_comments_and_emptyspace(std::istream& input_stream);
 
 // skips to character after next newline
-bool skip_line(std::istream& input_stream);
+LL_COMMON_API bool skip_line(std::istream& input_stream);
 
 // skips to beginning of next non-emptyspace
-bool skip_to_next_word(std::istream& input_stream);
+LL_COMMON_API bool skip_to_next_word(std::istream& input_stream);
 
 // skips to character after the end of next keyword 
 // a 'keyword' is defined as the first word on a line
-bool skip_to_end_of_next_keyword(const char* keyword, std::istream& input_stream);
+LL_COMMON_API bool skip_to_end_of_next_keyword(const char* keyword, std::istream& input_stream);
 
 // skip_to_start_of_next_keyword() is disabled -- might tickle corruption bug 
 // in windows iostream
@@ -65,14 +65,14 @@ bool skip_to_end_of_next_keyword(const char* keyword, std::istream& input_stream
 
 // characters are pulled out of input_stream and appended to output_string
 // returns result of input_stream.good() after characters are pulled
-bool get_word(std::string& output_string, std::istream& input_stream);
-bool get_line(std::string& output_string, std::istream& input_stream);
+LL_COMMON_API bool get_word(std::string& output_string, std::istream& input_stream);
+LL_COMMON_API bool get_line(std::string& output_string, std::istream& input_stream);
 
 // characters are pulled out of input_stream (up to a max of 'n')
 // and appended to output_string 
 // returns result of input_stream.good() after characters are pulled
-bool get_word(std::string& output_string, std::istream& input_stream, int n);
-bool get_line(std::string& output_string, std::istream& input_stream, int n);
+LL_COMMON_API bool get_word(std::string& output_string, std::istream& input_stream, int n);
+LL_COMMON_API bool get_line(std::string& output_string, std::istream& input_stream, int n);
 
 // unget_line() is disabled -- might tickle corruption bug in windows iostream
 //// backs up the input_stream by line_size + 1 characters
@@ -82,28 +82,28 @@ bool get_line(std::string& output_string, std::istream& input_stream, int n);
 
 // removes the last char in 'line' if it matches 'c'
 // returns true if removed last char
-bool remove_last_char(char c, std::string& line);
+LL_COMMON_API bool remove_last_char(char c, std::string& line);
 
 // replaces escaped characters with the correct characters from left to right
 // "\\" ---> '\\' 
 // "\n" ---> '\n' 
-void unescape_string(std::string& line);
+LL_COMMON_API void unescape_string(std::string& line);
 
 // replaces unescaped characters with expanded equivalents from left to right
 // '\\' ---> "\\" 
 // '\n' ---> "\n" 
-void escape_string(std::string& line);
+LL_COMMON_API void escape_string(std::string& line);
 
 // replaces each '\n' character with ' '
-void replace_newlines_with_whitespace(std::string& line);
+LL_COMMON_API void replace_newlines_with_whitespace(std::string& line);
 
 // erases any double-quote characters in line
-void remove_double_quotes(std::string& line);
+LL_COMMON_API void remove_double_quotes(std::string& line);
 
 // the 'keyword' is defined as the first word on a line
 // the 'value' is everything after the keyword on the same line
 // starting at the first non-whitespace and ending right before the newline
-void get_keyword_and_value(std::string& keyword, 
+LL_COMMON_API void get_keyword_and_value(std::string& keyword, 
 						   std::string& value, 
 						   const std::string& line);
 
@@ -111,13 +111,13 @@ void get_keyword_and_value(std::string& keyword,
 // read anymore or until we hit the count.  Some istream
 // implimentations have a max that they will read.
 // Returns the number of bytes read.
-std::streamsize fullread(
+LL_COMMON_API std::streamsize fullread(
 	std::istream& istr,
 	char* buf,
 	std::streamsize requested);
 
 
-std::istream& operator>>(std::istream& str, const char *tocheck);
+LL_COMMON_API std::istream& operator>>(std::istream& str, const char *tocheck);
 
 #endif
 
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index 1aba0013538..da1900eadf9 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -147,7 +147,7 @@ struct char_traits<U16>
 };
 #endif
 
-class LLStringOps
+class LL_COMMON_API LLStringOps
 {
 private:
 	static long sltOffset;
@@ -194,13 +194,13 @@ class LLStringOps
  * @brief Return a string constructed from in without crashing if the
  * pointer is NULL.
  */
-std::string ll_safe_string(const char* in);
-std::string ll_safe_string(const char* in, S32 maxlen);
+LL_COMMON_API std::string ll_safe_string(const char* in);
+LL_COMMON_API std::string ll_safe_string(const char* in, S32 maxlen);
 
 
 // Allowing assignments from non-strings into format_map_t is apparently
 // *really* error-prone, so subclass std::string with just basic c'tors.
-class LLFormatMapString
+class LL_COMMON_API LLFormatMapString
 {
 public:
 	LLFormatMapString() {};
@@ -375,7 +375,7 @@ inline std::string chop_tail_copy(
  * @brief This translates a nybble stored as a hex value from 0-f back
  * to a nybble in the low order bits of the return byte.
  */
-U8 hex_as_nybble(char hex);
+LL_COMMON_API U8 hex_as_nybble(char hex);
 
 /**
  * @brief read the contents of a file into a string.
@@ -386,8 +386,8 @@ U8 hex_as_nybble(char hex);
  * @param filename The full name of the file to read.
  * @return Returns true on success. If false, str is unmodified.
  */
-bool _read_file_into_string(std::string& str, const std::string& filename);
-bool iswindividual(llwchar elem);
+LL_COMMON_API bool _read_file_into_string(std::string& str, const std::string& filename);
+LL_COMMON_API bool iswindividual(llwchar elem);
 
 /**
  * Unicode support
@@ -396,52 +396,52 @@ bool iswindividual(llwchar elem);
 // Make the incoming string a utf8 string. Replaces any unknown glyph
 // with the UNKOWN_CHARACTER. Once any unknown glph is found, the rest
 // of the data may not be recovered.
-std::string rawstr_to_utf8(const std::string& raw);
+LL_COMMON_API std::string rawstr_to_utf8(const std::string& raw);
 
 //
 // We should never use UTF16 except when communicating with Win32!
 //
 typedef std::basic_string<U16> llutf16string;
 
-LLWString utf16str_to_wstring(const llutf16string &utf16str, S32 len);
-LLWString utf16str_to_wstring(const llutf16string &utf16str);
+LL_COMMON_API LLWString utf16str_to_wstring(const llutf16string &utf16str, S32 len);
+LL_COMMON_API LLWString utf16str_to_wstring(const llutf16string &utf16str);
 
-llutf16string wstring_to_utf16str(const LLWString &utf32str, S32 len);
-llutf16string wstring_to_utf16str(const LLWString &utf32str);
+LL_COMMON_API llutf16string wstring_to_utf16str(const LLWString &utf32str, S32 len);
+LL_COMMON_API llutf16string wstring_to_utf16str(const LLWString &utf32str);
 
-llutf16string utf8str_to_utf16str ( const std::string& utf8str, S32 len);
-llutf16string utf8str_to_utf16str ( const std::string& utf8str );
+LL_COMMON_API llutf16string utf8str_to_utf16str ( const std::string& utf8str, S32 len);
+LL_COMMON_API llutf16string utf8str_to_utf16str ( const std::string& utf8str );
 
-LLWString utf8str_to_wstring(const std::string &utf8str, S32 len);
-LLWString utf8str_to_wstring(const std::string &utf8str);
+LL_COMMON_API LLWString utf8str_to_wstring(const std::string &utf8str, S32 len);
+LL_COMMON_API LLWString utf8str_to_wstring(const std::string &utf8str);
 // Same function, better name. JC
 inline LLWString utf8string_to_wstring(const std::string& utf8_string) { return utf8str_to_wstring(utf8_string); }
 
 //
-S32 wchar_to_utf8chars(llwchar inchar, char* outchars);
+LL_COMMON_API S32 wchar_to_utf8chars(llwchar inchar, char* outchars);
 
-std::string wstring_to_utf8str(const LLWString &utf32str, S32 len);
-std::string wstring_to_utf8str(const LLWString &utf32str);
+LL_COMMON_API std::string wstring_to_utf8str(const LLWString &utf32str, S32 len);
+LL_COMMON_API std::string wstring_to_utf8str(const LLWString &utf32str);
 
-std::string utf16str_to_utf8str(const llutf16string &utf16str, S32 len);
-std::string utf16str_to_utf8str(const llutf16string &utf16str);
+LL_COMMON_API std::string utf16str_to_utf8str(const llutf16string &utf16str, S32 len);
+LL_COMMON_API std::string utf16str_to_utf8str(const llutf16string &utf16str);
 
 // Length of this UTF32 string in bytes when transformed to UTF8
-S32 wstring_utf8_length(const LLWString& wstr); 
+LL_COMMON_API S32 wstring_utf8_length(const LLWString& wstr); 
 
 // Length in bytes of this wide char in a UTF8 string
-S32 wchar_utf8_length(const llwchar wc); 
+LL_COMMON_API S32 wchar_utf8_length(const llwchar wc); 
 
-std::string utf8str_tolower(const std::string& utf8str);
+LL_COMMON_API std::string utf8str_tolower(const std::string& utf8str);
 
 // Length in llwchar (UTF-32) of the first len units (16 bits) of the given UTF-16 string.
-S32 utf16str_wstring_length(const llutf16string &utf16str, S32 len);
+LL_COMMON_API S32 utf16str_wstring_length(const llutf16string &utf16str, S32 len);
 
 // Length in utf16string (UTF-16) of wlen wchars beginning at woffset.
-S32 wstring_utf16_length(const LLWString & wstr, S32 woffset, S32 wlen);
+LL_COMMON_API S32 wstring_utf16_length(const LLWString & wstr, S32 woffset, S32 wlen);
 
 // Length in wstring (i.e., llwchar count) of a part of a wstring specified by utf16 length (i.e., utf16 units.)
-S32 wstring_wstring_length_from_utf16_length(const LLWString & wstr, S32 woffset, S32 utf16_length, BOOL *unaligned = NULL);
+LL_COMMON_API S32 wstring_wstring_length_from_utf16_length(const LLWString & wstr, S32 woffset, S32 utf16_length, BOOL *unaligned = NULL);
 
 /**
  * @brief Properly truncate a utf8 string to a maximum byte count.
@@ -453,11 +453,11 @@ S32 wstring_wstring_length_from_utf16_length(const LLWString & wstr, S32 woffset
  * @param max_len The maximum number of bytes in the return value.
  * @return Returns a valid utf8 string with byte count <= max_len.
  */
-std::string utf8str_truncate(const std::string& utf8str, const S32 max_len);
+LL_COMMON_API std::string utf8str_truncate(const std::string& utf8str, const S32 max_len);
 
-std::string utf8str_trim(const std::string& utf8str);
+LL_COMMON_API std::string utf8str_trim(const std::string& utf8str);
 
-S32 utf8str_compare_insensitive(
+LL_COMMON_API S32 utf8str_compare_insensitive(
 	const std::string& lhs,
 	const std::string& rhs);
 
@@ -468,17 +468,17 @@ S32 utf8str_compare_insensitive(
  * @param target_char The wchar to be replaced
  * @param replace_char The wchar which is written on replace
  */
-std::string utf8str_substChar(
+LL_COMMON_API std::string utf8str_substChar(
 	const std::string& utf8str,
 	const llwchar target_char,
 	const llwchar replace_char);
 
-std::string utf8str_makeASCII(const std::string& utf8str);
+LL_COMMON_API std::string utf8str_makeASCII(const std::string& utf8str);
 
 // Hack - used for evil notecards.
-std::string mbcsstring_makeASCII(const std::string& str); 
+LL_COMMON_API std::string mbcsstring_makeASCII(const std::string& str); 
 
-std::string utf8str_removeCRLF(const std::string& utf8str);
+LL_COMMON_API std::string utf8str_removeCRLF(const std::string& utf8str);
 
 
 #if LL_WINDOWS
@@ -503,14 +503,21 @@ std::string utf8str_removeCRLF(const std::string& utf8str);
  * formatted string.
  *
  */
-int safe_snprintf(char* str, size_t size, const char* format, ...);
+
+// Deal with the differeneces on Windows
+namespace snprintf_hack
+{
+	LL_COMMON_API int snprintf(char *str, size_t size, const char *format, ...);
+}
+
+using snprintf_hack::snprintf;
 
 /**
  * @brief Convert a wide string to std::string
  *
  * This replaces the unsafe W2A macro from ATL.
  */
-std::string ll_convert_wide_to_string(const wchar_t* in);
+LL_COMMON_API std::string ll_convert_wide_to_string(const wchar_t* in);
 
 //@}
 #endif // LL_WINDOWS
@@ -533,7 +540,7 @@ namespace LLStringFn
 	 * with zero non-printable characters.
 	 * @param The replacement character. use LL_UNKNOWN_CHAR if unsure.
 	 */
-	void replace_nonprintable_in_ascii(
+	LL_COMMON_API void replace_nonprintable_in_ascii(
 		std::basic_string<char>& string,
 		char replacement);
 
@@ -547,7 +554,7 @@ namespace LLStringFn
 	 * with zero non-printable characters and zero pipe characters.
 	 * @param The replacement character. use LL_UNKNOWN_CHAR if unsure.
 	 */
-	void replace_nonprintable_and_pipe_in_ascii(std::basic_string<char>& str,
+	LL_COMMON_API void replace_nonprintable_and_pipe_in_ascii(std::basic_string<char>& str,
 									   char replacement);
 
 
@@ -556,7 +563,7 @@ namespace LLStringFn
 	 * Returns a copy of the string with those characters removed.
 	 * Works with US ASCII and UTF-8 encoded strings.  JC
 	 */
-	std::string strip_invalid_xml(const std::string& input);
+	LL_COMMON_API std::string strip_invalid_xml(const std::string& input);
 
 
 	/**
@@ -567,7 +574,7 @@ namespace LLStringFn
 	 * with zero non-printable characters.
 	 * @param The replacement character. use LL_UNKNOWN_CHAR if unsure.
 	 */
-	void replace_ascii_controlchars(
+	LL_COMMON_API void replace_ascii_controlchars(
 		std::basic_string<char>& string,
 		char replacement);
 }
diff --git a/indra/llcommon/llstringtable.h b/indra/llcommon/llstringtable.h
index 4492063275e..b13b016396a 100644
--- a/indra/llcommon/llstringtable.h
+++ b/indra/llcommon/llstringtable.h
@@ -56,7 +56,7 @@
 
 const U32 MAX_STRINGS_LENGTH = 256;
 
-class LLStringTableEntry
+class LL_COMMON_API LLStringTableEntry
 {
 public:
 	LLStringTableEntry(const char *str)
@@ -81,7 +81,7 @@ class LLStringTableEntry
 	S32  mCount;
 };
 
-class LLStringTable
+class LL_COMMON_API LLStringTable
 {
 public:
 	LLStringTable(int tablesize);
@@ -115,7 +115,7 @@ class LLStringTable
 #endif	
 };
 
-extern LLStringTable gStringTable;
+extern LL_COMMON_API LLStringTable gStringTable;
 
 //============================================================================
 
@@ -125,7 +125,7 @@ extern LLStringTable gStringTable;
 
 typedef const std::string* LLStdStringHandle;
 
-class LLStdStringTable
+class LL_COMMON_API LLStdStringTable
 {
 public:
 	LLStdStringTable(S32 tablesize = 0)
diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h
index 03f48ca0187..c2c45bec9a2 100644
--- a/indra/llcommon/llsys.h
+++ b/indra/llcommon/llsys.h
@@ -45,7 +45,7 @@
 #include <iosfwd>
 #include <string>
 
-class LLOSInfo
+class LL_COMMON_API LLOSInfo
 {
 public:
 	LLOSInfo();
@@ -70,7 +70,7 @@ class LLOSInfo
 };
 
 
-class LLCPUInfo
+class LL_COMMON_API LLCPUInfo
 {
 public:
 	LLCPUInfo();	
@@ -99,7 +99,7 @@ class LLCPUInfo
 //
 //	CLASS		LLMemoryInfo
 
-class LLMemoryInfo
+class LL_COMMON_API LLMemoryInfo
 
 /*!	@brief		Class to query the memory subsystem
 
@@ -123,15 +123,15 @@ class LLMemoryInfo
 };
 
 
-std::ostream& operator<<(std::ostream& s, const LLOSInfo& info);
-std::ostream& operator<<(std::ostream& s, const LLCPUInfo& info);
-std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info);
+LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLOSInfo& info);
+LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLCPUInfo& info);
+LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info);
 
 // gunzip srcfile into dstfile.  Returns FALSE on error.
-BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile);
+BOOL LL_COMMON_API gunzip_file(const std::string& srcfile, const std::string& dstfile);
 // gzip srcfile into dstfile.  Returns FALSE on error.
-BOOL gzip_file(const std::string& srcfile, const std::string& dstfile);
+BOOL LL_COMMON_API gzip_file(const std::string& srcfile, const std::string& dstfile);
 
-extern LLCPUInfo gSysCPU;
+extern LL_COMMON_API LLCPUInfo gSysCPU;
 
 #endif // LL_LLSYS_H
diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h
index f25339f48d1..e6bf95aaa96 100644
--- a/indra/llcommon/llthread.h
+++ b/indra/llcommon/llthread.h
@@ -38,11 +38,11 @@
 
 #include "apr_thread_cond.h"
 
-class LLThread;
-class LLMutex;
-class LLCondition;
+class LL_COMMON_API LLThread;
+class LL_COMMON_API LLMutex;
+class LL_COMMON_API LLCondition;
 
-class LLThread
+class LL_COMMON_API LLThread
 {
 public:
 	typedef enum e_thread_status
@@ -130,7 +130,7 @@ class LLThread
 
 //============================================================================
 
-class LLMutex
+class LL_COMMON_API LLMutex
 {
 public:
 	LLMutex(apr_pool_t *apr_poolp); // NULL pool constructs a new pool for the mutex
@@ -147,7 +147,7 @@ class LLMutex
 };
 
 // Actually a condition/mutex pair (since each condition needs to be associated with a mutex).
-class LLCondition : public LLMutex
+class LL_COMMON_API LLCondition : public LLMutex
 {
 public:
 	LLCondition(apr_pool_t *apr_poolp); // Defaults to global pool, could use the thread pool as well.
@@ -194,7 +194,7 @@ void LLThread::unlockData()
 
 // see llmemory.h for LLPointer<> definition
 
-class LLThreadSafeRefCount
+class LL_COMMON_API LLThreadSafeRefCount
 {
 public:
 	static void initThreadSafeRefCount(); // creates sMutex
@@ -246,7 +246,7 @@ class LLThreadSafeRefCount
 
 // Simple responder for self destructing callbacks
 // Pure virtual class
-class LLResponder : public LLThreadSafeRefCount
+class LL_COMMON_API LLResponder : public LLThreadSafeRefCount
 {
 protected:
 	virtual ~LLResponder();
diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h
index 0319bec45b6..d009c0f5f7d 100644
--- a/indra/llcommon/lltimer.h
+++ b/indra/llcommon/lltimer.h
@@ -55,7 +55,7 @@ const U32	USEC_PER_HOUR	= USEC_PER_MIN * MIN_PER_HOUR;
 const U32	SEC_PER_HOUR	= SEC_PER_MIN * MIN_PER_HOUR;
 const F64 	SEC_PER_USEC 	= 1.0 / (F64) USEC_PER_SEC;
 
-class LLTimer 
+class LL_COMMON_API LLTimer 
 {
 public:
 	static LLTimer *sTimer;				// global timer
@@ -114,17 +114,17 @@ class LLTimer
 //
 // Various functions for initializing/accessing clock and timing stuff.  Don't use these without REALLY knowing how they work.
 //
-U64 get_clock_count();
-F64 calc_clock_frequency(U32 msecs);
-void update_clock_frequencies();
+LL_COMMON_API U64 get_clock_count();
+LL_COMMON_API F64 calc_clock_frequency(U32 msecs);
+LL_COMMON_API void update_clock_frequencies();
 
 // Sleep for milliseconds
-void ms_sleep(U32 ms);
-U32 micro_sleep(U64 us, U32 max_yields = 0xFFFFFFFF);
+LL_COMMON_API void ms_sleep(U32 ms);
+LL_COMMON_API U32 micro_sleep(U64 us, U32 max_yields = 0xFFFFFFFF);
 
 // Returns the correct UTC time in seconds, like time(NULL).
 // Useful on the viewer, which may have its local clock set wrong.
-time_t time_corrected();
+LL_COMMON_API time_t time_corrected();
 
 static inline time_t time_min()
 {
@@ -155,24 +155,24 @@ static inline time_t time_max()
 }
 
 // Correction factor used by time_corrected() above.
-extern S32 gUTCOffset;
+extern LL_COMMON_API S32 gUTCOffset;
 
 // Is the current computer (in its current time zone)
 // observing daylight savings time?
-BOOL is_daylight_savings();
+LL_COMMON_API BOOL is_daylight_savings();
 
 // Converts internal "struct tm" time buffer to Pacific Standard/Daylight Time
 // Usage:
 // S32 utc_time;
 // utc_time = time_corrected();
 // struct tm* internal_time = utc_to_pacific_time(utc_time, gDaylight);
-struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time);
+LL_COMMON_API struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time);
 
-void microsecondsToTimecodeString(U64 current_time, std::string& tcstring);
-void secondsToTimecodeString(F32 current_time, std::string& tcstring);
+LL_COMMON_API void microsecondsToTimecodeString(U64 current_time, std::string& tcstring);
+LL_COMMON_API void secondsToTimecodeString(F32 current_time, std::string& tcstring);
 
 // class for scheduling a function to be called at a given frequency (approximate, inprecise)
-class LLEventTimer : protected LLInstanceTracker<LLEventTimer>
+class LL_COMMON_API LLEventTimer : protected LLInstanceTracker<LLEventTimer>
 {
 public:
 	LLEventTimer(F32 period);	// period is the amount of time between each call to tick() in seconds
@@ -190,4 +190,6 @@ class LLEventTimer : protected LLInstanceTracker<LLEventTimer>
 	F32 mPeriod;
 };
 
+U64 LL_COMMON_API totalTime();					// Returns current system time in microseconds
+
 #endif
diff --git a/indra/llcommon/lluri.h b/indra/llcommon/lluri.h
index 156d80b97ec..a35598ffe53 100644
--- a/indra/llcommon/lluri.h
+++ b/indra/llcommon/lluri.h
@@ -37,9 +37,9 @@
 
 #include <string>
 
-class LLSD;
-class LLUUID;
-class LLApp;
+class LL_COMMON_API LLSD;
+class LL_COMMON_API LLUUID;
+class LL_COMMON_API LLApp;
 
 /** 
  *
@@ -47,7 +47,7 @@ class LLApp;
  * See: http://www.ietf.org/rfc/rfc3986.txt
  *
  */
-class LLURI
+class LL_COMMON_API LLURI
 {
 public:
   LLURI();
diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h
index 4b32138a065..68e403fd4f2 100644
--- a/indra/llcommon/lluuid.h
+++ b/indra/llcommon/lluuid.h
@@ -47,7 +47,7 @@ struct uuid_time_t {
 	U32 low;
 		};
 
-class LLUUID
+class LL_COMMON_API LLUUID
 {
 public:
 	//
@@ -106,8 +106,8 @@ class LLUUID
 	LLUUID combine(const LLUUID& other) const;
 	void combine(const LLUUID& other, LLUUID& result) const;  
 
-	friend std::ostream&	 operator<<(std::ostream& s, const LLUUID &uuid);
-	friend std::istream&	 operator>>(std::istream& s, LLUUID &uuid);
+	friend LL_COMMON_API std::ostream&	 operator<<(std::ostream& s, const LLUUID &uuid);
+	friend LL_COMMON_API std::istream&	 operator>>(std::istream& s, LLUUID &uuid);
 
 	void toString(char *out) const;		// Does not allocate memory, needs 36 characters (including \0)
 	void toString(std::string& out) const;
@@ -323,7 +323,7 @@ typedef std::set<LLUUID, lluuid_less> uuid_list_t;
  */
 typedef LLUUID LLAssetID;
 
-class LLTransactionID : public LLUUID
+class LL_COMMON_API LLTransactionID : public LLUUID
 {
 public:
 	LLTransactionID() : LLUUID() { }
diff --git a/indra/llcommon/llworkerthread.h b/indra/llcommon/llworkerthread.h
index 19407f44638..a12bd52a648 100644
--- a/indra/llcommon/llworkerthread.h
+++ b/indra/llcommon/llworkerthread.h
@@ -50,7 +50,7 @@ class LLWorkerClass;
 // Note: ~LLWorkerThread is O(N) N=# of worker threads, assumed to be small
 //   It is assumed that LLWorkerThreads are rarely created/destroyed.
 
-class LLWorkerThread : public LLQueuedThread
+class LL_COMMON_API LLWorkerThread : public LLQueuedThread
 {
 public:
 	class WorkRequest : public LLQueuedThread::QueuedRequest
@@ -113,7 +113,7 @@ class LLWorkerThread : public LLQueuedThread
 // Only one background task can be active at a time (per instance).
 //  i.e. don't call addWork() if haveWork() returns true
 
-class LLWorkerClass
+class LL_COMMON_API LLWorkerClass
 {
 	friend class LLWorkerThread;
 	friend class LLWorkerThread::WorkRequest;
diff --git a/indra/llcommon/metaclass.h b/indra/llcommon/metaclass.h
index cc10f1675f2..8b93e0d6d59 100644
--- a/indra/llcommon/metaclass.h
+++ b/indra/llcommon/metaclass.h
@@ -40,10 +40,10 @@
 
 #include "stdtypes.h"
 
-class LLReflective;
-class LLMetaProperty;
-class LLMetaMethod;
-class LLMetaClass
+class LL_COMMON_API LLReflective;
+class LL_COMMON_API LLMetaProperty;
+class LL_COMMON_API LLMetaMethod;
+class LL_COMMON_API LLMetaClass
 {
 public:
 
diff --git a/indra/llcommon/metaproperty.h b/indra/llcommon/metaproperty.h
index e5ac35907c0..96e1b314a43 100644
--- a/indra/llcommon/metaproperty.h
+++ b/indra/llcommon/metaproperty.h
@@ -39,9 +39,9 @@
 #include "llsd.h"
 #include "reflective.h"
 
-class LLMetaClass;
-class LLReflective;
-class LLMetaProperty
+class LL_COMMON_API LLMetaClass;
+class LL_COMMON_API LLReflective;
+class LL_COMMON_API LLMetaProperty
 {
 public:
 	LLMetaProperty(const std::string& name, const LLMetaClass& object_class);
diff --git a/indra/llcommon/reflective.h b/indra/llcommon/reflective.h
index e2c18ebc6da..541712538be 100644
--- a/indra/llcommon/reflective.h
+++ b/indra/llcommon/reflective.h
@@ -35,8 +35,8 @@
 #ifndef LL_REFLECTIVE_H
 #define LL_REFLECTIVE_H
 
-class LLMetaClass;
-class LLReflective
+class LL_COMMON_API LLMetaClass;
+class LL_COMMON_API LLReflective
 {
 public:
 	LLReflective();
diff --git a/indra/llcommon/tests/lleventcoro_test.cpp b/indra/llcommon/tests/lleventcoro_test.cpp
index cd39ac4df3c..695b1ca9f43 100644
--- a/indra/llcommon/tests/lleventcoro_test.cpp
+++ b/indra/llcommon/tests/lleventcoro_test.cpp
@@ -53,6 +53,9 @@
 #include <boost/coroutine/future.hpp>
 #include <boost/bind.hpp>
 #include <boost/range.hpp>
+
+#include "linden_common.h"
+
 #include <iostream>
 #include <string>
 
diff --git a/indra/llcommon/timing.h b/indra/llcommon/timing.h
index 2b9f60adad7..140ce1fcaa1 100644
--- a/indra/llcommon/timing.h
+++ b/indra/llcommon/timing.h
@@ -43,7 +43,6 @@ const F32 SEC_TO_MICROSEC = 1000000.f;
 const U64 SEC_TO_MICROSEC_U64 = 1000000;
 const U32 SEC_PER_DAY = 86400;
 
-// This is just a stub, implementation in lltimer.cpp.  This file will be deprecated in the future.
-U64 totalTime();					// Returns current system time in microseconds
+// functionality has been moved lltimer.{cpp,h}.  This file will be deprecated in the future.
 
 #endif
diff --git a/indra/llcommon/u64.h b/indra/llcommon/u64.h
index 09a6b3e18d8..eb51131e946 100644
--- a/indra/llcommon/u64.h
+++ b/indra/llcommon/u64.h
@@ -39,14 +39,14 @@
  * @param str The string to parse.
  * @return Returns the first U64 value found in the string or 0 on failure.
  */
-U64 str_to_U64(const std::string& str);
+LL_COMMON_API U64 str_to_U64(const std::string& str);
 
 /**
  * @brief Given a U64 value, return a printable representation.
  * @param value The U64 to turn into a printable character array.
  * @return Returns the result string.
  */
-std::string U64_to_str(U64 value);
+LL_COMMON_API std::string U64_to_str(U64 value);
 
 /**
  * @brief Given a U64 value, return a printable representation.
@@ -65,16 +65,16 @@ std::string U64_to_str(U64 value);
  * @param result_size The size of the buffer allocated. Use U64_BUF.
  * @return Returns the result pointer.
  */
-char* U64_to_str(U64 value, char* result, S32 result_size);
+LL_COMMON_API char* U64_to_str(U64 value, char* result, S32 result_size);
 
 /**
  * @brief Convert a U64 to the closest F64 value.
  */
-F64 U64_to_F64(const U64 value);
+LL_COMMON_API F64 U64_to_F64(const U64 value);
 
 /**
  * @brief Helper function to wrap strtoull() which is not available on windows.
  */
-U64 llstrtou64(const char* str, char** end, S32 base);
+LL_COMMON_API U64 llstrtou64(const char* str, char** end, S32 base);
 
 #endif
diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp
index 60ebc44a3e4..bd8c0d58e5a 100644
--- a/indra/llinventory/llparcel.cpp
+++ b/indra/llinventory/llparcel.cpp
@@ -43,7 +43,7 @@
 #include "llsdutil.h"
 #include "lltransactiontypes.h"
 #include "lltransactionflags.h"
-#include "llsdutil.h"
+#include "llsdutil_math.h"
 #include "message.h"
 #include "u64.h"
 
diff --git a/indra/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt
index 6a329fabb67..f84cdf1563b 100644
--- a/indra/llmath/CMakeLists.txt
+++ b/indra/llmath/CMakeLists.txt
@@ -60,6 +60,7 @@ set(llmath_HEADER_FILES
     llv4vector3.h
     llvolume.h
     llvolumemgr.h
+    llsdutil_math.h
     m3math.h
     m4math.h
     raytrace.h
diff --git a/indra/llmath/llsdutil_math.cpp b/indra/llmath/llsdutil_math.cpp
index c5176681cef..1bd12ae5137 100644
--- a/indra/llmath/llsdutil_math.cpp
+++ b/indra/llmath/llsdutil_math.cpp
@@ -34,7 +34,7 @@
 
 #include "linden_common.h"
 
-#include "llsdutil.h"
+#include "llsdutil_math.h"
 
 #include "v3math.h"
 #include "v4math.h"
diff --git a/indra/llmath/llsdutil_math.h b/indra/llmath/llsdutil_math.h
new file mode 100644
index 00000000000..121f4b746a8
--- /dev/null
+++ b/indra/llmath/llsdutil_math.h
@@ -0,0 +1,70 @@
+/** 
+ * @file llsdutil_math.h
+ * @author Brad
+ * @date 2009-05-19
+ * @brief Utility classes, functions, etc, for using structured data with math classes.
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLSDUTIL_MATH_H
+#define LL_LLSDUTIL_MATH_H
+
+class LL_COMMON_API LLSD;
+
+// vector3
+class LLVector3;
+LLSD ll_sd_from_vector3(const LLVector3& vec);
+LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index = 0);
+
+// vector4
+class LLVector4;
+LLSD ll_sd_from_vector4(const LLVector4& vec);
+LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index = 0);
+
+// vector3d (double)
+class LLVector3d;
+LLSD ll_sd_from_vector3d(const LLVector3d& vec);
+LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index = 0);
+
+// vector2
+class LLVector2;
+LLSD ll_sd_from_vector2(const LLVector2& vec);
+LLVector2 ll_vector2_from_sd(const LLSD& sd);
+
+// Quaternion
+class LLQuaternion;
+LLSD ll_sd_from_quaternion(const LLQuaternion& quat);
+LLQuaternion ll_quaternion_from_sd(const LLSD& sd);
+
+// color4
+class LLColor4;
+LLSD ll_sd_from_color4(const LLColor4& c);
+LLColor4 ll_color4_from_sd(const LLSD& sd);
+
+#endif // LL_LLSDUTIL_MATH_H
diff --git a/indra/llmessage/llinstantmessage.cpp b/indra/llmessage/llinstantmessage.cpp
index aa64232e427..e41b332e7bb 100644
--- a/indra/llmessage/llinstantmessage.cpp
+++ b/indra/llmessage/llinstantmessage.cpp
@@ -40,7 +40,7 @@
 #include "lluuid.h"
 #include "llsd.h"
 #include "llsdserialize.h"
-#include "llsdutil.h"
+#include "llsdutil_math.h"
 #include "llpointer.h"
 #include "message.h"
 
diff --git a/indra/llmessage/llpartdata.cpp b/indra/llmessage/llpartdata.cpp
index 485bc6aa446..9376cde7b50 100644
--- a/indra/llmessage/llpartdata.cpp
+++ b/indra/llmessage/llpartdata.cpp
@@ -39,6 +39,8 @@
 #include "v4coloru.h"
 
 #include "llsdutil.h"
+#include "llsdutil_math.h"
+
 
 
 const S32 PS_PART_DATA_BLOCK_SIZE = 4 + 2 + 4 + 4 + 2 + 2; // 18
diff --git a/indra/llmessage/llregionpresenceverifier.cpp b/indra/llmessage/llregionpresenceverifier.cpp
index 0527d5cb8de..e6be4af07b2 100644
--- a/indra/llmessage/llregionpresenceverifier.cpp
+++ b/indra/llmessage/llregionpresenceverifier.cpp
@@ -30,6 +30,8 @@
  * $/LicenseInfo$
  */
 
+#include "linden_common.h"
+
 #include "llregionpresenceverifier.h"
 #include "llhttpclientinterface.h"
 #include <sstream>
diff --git a/indra/llmessage/llsdmessagebuilder.cpp b/indra/llmessage/llsdmessagebuilder.cpp
index 21937f022f4..6e41b03895c 100755
--- a/indra/llmessage/llsdmessagebuilder.cpp
+++ b/indra/llmessage/llsdmessagebuilder.cpp
@@ -37,6 +37,7 @@
 #include "llmessagetemplate.h"
 #include "llquaternion.h"
 #include "llsdutil.h"
+#include "llsdutil_math.h"
 #include "llsdserialize.h"
 #include "u64.h"
 #include "v3dmath.h"
diff --git a/indra/llmessage/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp
index e699ec9e28b..845a12d23b9 100755
--- a/indra/llmessage/llsdmessagereader.cpp
+++ b/indra/llmessage/llsdmessagereader.cpp
@@ -38,6 +38,7 @@
 #include "llsdmessagebuilder.h"
 #include "llsdutil.h"
 
+#include "llsdutil_math.h"
 #include "v3math.h"
 #include "v4math.h"
 #include "v3dmath.h"
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp
index 13facc0d582..a0fcecfe5fb 100644
--- a/indra/llprimitive/llprimitive.cpp
+++ b/indra/llprimitive/llprimitive.cpp
@@ -43,7 +43,7 @@
 #include "llvolumemgr.h"
 #include "llstring.h"
 #include "lldatapacker.h"
-#include "llsdutil.h"
+#include "llsdutil_math.h"
 #include "llprimtexturelist.h"
 
 /**
diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp
index 3bcd831142a..2736d54cc8b 100644
--- a/indra/llprimitive/lltextureentry.cpp
+++ b/indra/llprimitive/lltextureentry.cpp
@@ -33,7 +33,7 @@
 #include "linden_common.h"
 
 #include "lltextureentry.h"
-#include "llsdutil.h"
+#include "llsdutil_math.h"
 
 const U8 DEFAULT_BUMP_CODE = 0;  // no bump or shininess
 
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 61194c4ecfa..f39e88f4834 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -547,8 +547,6 @@ void LLGLManager::shutdownGL()
 // these are used to turn software blending on. They appear in the Debug/Avatar menu
 // presence of vertex skinning/blending or vertex programs will set these to FALSE by default.
 
-extern LLCPUInfo gSysCPU;
-
 void LLGLManager::initExtensions()
 {
 #if LL_MESA_HEADLESS
diff --git a/indra/llui/llfunctorregistry.cpp b/indra/llui/llfunctorregistry.cpp
index 0c5b1655b10..5f9644f2584 100644
--- a/indra/llui/llfunctorregistry.cpp
+++ b/indra/llui/llfunctorregistry.cpp
@@ -31,6 +31,7 @@
  * $/LicenseInfo$
  **/
 
+#include "linden_common.h"
 #include "llfunctorregistry.h"
 
 // This is a default functor always resident in the system.
diff --git a/indra/lscript/lscript_execute/llscriptresource.cpp b/indra/lscript/lscript_execute/llscriptresource.cpp
index 6c4776c2e44..cd3696ab3fa 100644
--- a/indra/lscript/lscript_execute/llscriptresource.cpp
+++ b/indra/lscript/lscript_execute/llscriptresource.cpp
@@ -30,6 +30,8 @@
  * $/LicenseInfo$
  */
 
+#include "linden_common.h"
+
 #include "llscriptresource.h"
 #include "llerror.h"
 
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index 35613b7c34f..e863be40e19 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -44,6 +44,7 @@
 #include "llgl.h"
 #include "llsecondlifeurls.h"
 
+#include "llappviewer.h"
 #include "llviewercontrol.h"
 #include "llworld.h"
 #include "lldrawpoolterrain.h"
@@ -58,11 +59,6 @@
 #include "lldxhardware.h"
 #endif
 
-//
-// externs
-//
-extern LLMemoryInfo gSysMemory;
-extern LLCPUInfo gSysCPU;
 
 #if LL_DARWIN
 const char FEATURE_TABLE_FILENAME[] = "featuretable_mac.txt";
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index 9b5d322ba6b..356ecff236e 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -61,8 +61,6 @@
 #include "llmediamanager.h"
 
 
-extern LLCPUInfo gSysCPU;
-extern LLMemoryInfo gSysMemory;
 extern U32 gPacketsIn;
 
 static std::string get_viewer_release_notes_url();
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 26ce5c5ac42..9e3bc76c9cf 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -40,7 +40,7 @@
 #include "llerror.h"
 #include "llbutton.h"
 #include "llhttpclient.h"
-#include "llsdutil.h"
+#include "llsdutil_math.h"
 #include "llstring.h"
 #include "lluictrlfactory.h"
 
diff --git a/indra/newview/llpanelplace.cpp b/indra/newview/llpanelplace.cpp
index 227faaa584d..ee194ee7e81 100644
--- a/indra/newview/llpanelplace.cpp
+++ b/indra/newview/llpanelplace.cpp
@@ -59,6 +59,7 @@
 //#include "llviewermenu.h"	// create_landmark()
 #include "llweb.h"
 #include "llsdutil.h"
+#include "llsdutil_math.h"
 
 //static
 std::list<LLPanelPlace*> LLPanelPlace::sAllPanels;
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index eddc23b0c44..41568217c0b 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -70,7 +70,7 @@
 #include "llregionhandle.h"
 #include "llsd.h"
 #include "llsdserialize.h"
-#include "llsdutil.h"
+#include "llsdutil_math.h"
 #include "llsecondlifeurls.h"
 #include "llstring.h"
 #include "lluserrelations.h"
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index da9587a3597..224ccf41b60 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -58,6 +58,7 @@
 #include "llparcelselection.h"
 #include "llresmgr.h"
 #include "llsdutil.h"
+#include "llsdutil_math.h"
 #include "llstatusbar.h"
 #include "llui.h"
 #include "llviewerimage.h"
diff --git a/indra/newview/tests/llagentaccess_test.cpp b/indra/newview/tests/llagentaccess_test.cpp
index 42872d85fba..e08193f7856 100644
--- a/indra/newview/tests/llagentaccess_test.cpp
+++ b/indra/newview/tests/llagentaccess_test.cpp
@@ -29,6 +29,8 @@
  * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
+
+#include "linden_common.h"
 #include "../test/lltut.h"
 
 #include "../llagentaccess.h"
diff --git a/indra/test/llsdmessagebuilder_tut.cpp b/indra/test/llsdmessagebuilder_tut.cpp
index 27ab127772f..9edb9157034 100755
--- a/indra/test/llsdmessagebuilder_tut.cpp
+++ b/indra/test/llsdmessagebuilder_tut.cpp
@@ -44,6 +44,7 @@
 #include "v3dmath.h"
 #include "v3math.h"
 #include "v4math.h"
+#include "llsdutil.cpp"
 #include "llsdutil_math.cpp"
 #include "lltemplatemessagebuilder.h"
 
diff --git a/indra/test/llsdmessagereader_tut.cpp b/indra/test/llsdmessagereader_tut.cpp
index 36cfe5ebfcd..f11e148ccaf 100755
--- a/indra/test/llsdmessagereader_tut.cpp
+++ b/indra/test/llsdmessagereader_tut.cpp
@@ -42,6 +42,7 @@
 #include "message.h"
 #include "llsdmessagereader.h"
 #include "llsdutil.h"
+#include "llsdutil_math.h"
 
 namespace tut
 {	
diff --git a/indra/test/llsdutil_tut.cpp b/indra/test/llsdutil_tut.cpp
index 093a29652c6..35ab80e7916 100644
--- a/indra/test/llsdutil_tut.cpp
+++ b/indra/test/llsdutil_tut.cpp
@@ -44,6 +44,7 @@
 #include "v4math.h"
 #include "llquaternion.h"
 #include "llsdutil.h"
+#include "llsdutil_math.h"
 #include <set>
 #include <boost/range.hpp>
 
-- 
GitLab