diff --git a/CMakeLists.txt b/CMakeLists.txt
index bba9a1af5c3f1bdee78d759d11dd67aab6fec96d..8a2d1042b05134306a9e26cbe65170f6c45ebcad 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,9 @@ endif(CMAKE_COMPILER_IS_GNUCXX)
 set(LIBS "")
 include_directories(${Corpus2Library_SOURCE_DIR})
 
+set(Boost_USE_STATIC_LIBS        ON)
+set(Boost_USE_MULTITHREADED      ON)
+set(Boost_USE_STATIC_RUNTIME    OFF)
 find_package(Boost 1.41 REQUIRED COMPONENTS program_options filesystem regex)
 
 set(LIBCORPUS2_INSTALL_DATA_DIR share/corpus2)
@@ -48,7 +51,25 @@ FIND_PATH(LIBCORPUS2_SRC_DATA_DIR
     test.tagset
     ${CMAKE_SOURCE_DIR}/corpus2data
 )
-MARK_AS_ADVANCED(LIBMACA_SRC_DATA_DIR)
+MARK_AS_ADVANCED(LIBCORPUS2_SRC_DATA_DIR)
+
+# For DLLs on Windows (aka SHARED libraries) you have to explicitly
+# specify the external API of the library. Nothing is exported
+# by default.
+# For UNIX on the other hand everything is exported by default.
+# We were building libraries SHARED but without specyfing
+# external API. It worked on UNIX but not on Windows.
+# This is changed now so add_library entries do not specify library
+# type and therefore use default. Below, the default is set
+# to build SHARED libs on anything but WIN32, so for Windows/cygwin
+# we are building STATIC (todo: is cygwin ok w/o externs?)
+# To make DLLs on Windows, exports have to be defined and then
+# add_library entry changed to state SHARED for given library.
+# Once this is done for all libraries, and all are marked
+# explicitly as SHARED, the below will won't make a difference.
+if(NOT WIN32)
+    set(BUILD_SHARED_LIBS TRUE)
+endif(NOT WIN32)
 
 add_subdirectory(libpwrutils)
 add_subdirectory(libcorpus2)
diff --git a/CMakeScripts/FindLoki.cmake b/CMakeScripts/FindLoki.cmake
index 76ebff190f19e038ab2ff62c460312f5471ee410..27fa48b7ec9519b8cefd698efdf33f73401e9b3b 100644
--- a/CMakeScripts/FindLoki.cmake
+++ b/CMakeScripts/FindLoki.cmake
@@ -1,6 +1,6 @@
-FIND_PATH(LOKI_INCLUDE_DIR LokiExport.h /usr/include/loki /usr/local/include/loki)
+FIND_PATH(LOKI_INCLUDE_DIR loki/LokiExport.h /usr/include /usr/local/include)
 
-FIND_LIBRARY(LOKI_LIBRARY NAMES loki PATH /usr/lib /usr/local/lib) 
+FIND_LIBRARY(LOKI_LIBRARY NAMES loki PATHS /usr/lib /usr/local/lib) 
 
 MARK_AS_ADVANCED(LOKI_LIBRARY)
 MARK_AS_ADVANCED(LOKI_INCLUDE_DIR)
diff --git a/libcorpus2/CMakeLists.txt b/libcorpus2/CMakeLists.txt
index 9433e273b52ad02526ed897d232b4c9771513d23..50e5d29123913ad6419462525daf082d755c62cc 100644
--- a/libcorpus2/CMakeLists.txt
+++ b/libcorpus2/CMakeLists.txt
@@ -68,7 +68,7 @@ SET(libcorpus2_STAT_SRC
 
 file(GLOB_RECURSE INCS "*.h")
 
-add_library(corpus2 SHARED ${libcorpus2_STAT_SRC} ${INCS})
+add_library(corpus2 ${libcorpus2_STAT_SRC} ${INCS})
 target_link_libraries(corpus2 ${LIBS})
 set_target_properties(corpus2 PROPERTIES
 	VERSION "${corpus2_ver_major}.${corpus2_ver_minor}"
diff --git a/libcorpus2/tagset.cpp b/libcorpus2/tagset.cpp
index 98d402b1b231c5d613b4996412b23e970645f3b3..6c0e499e8f30eb56670a5040692a45dab66b6c0c 100644
--- a/libcorpus2/tagset.cpp
+++ b/libcorpus2/tagset.cpp
@@ -280,7 +280,12 @@ Tag Tagset::make_tag(idx_t pos_idx, mask_t values, bool allow_extra) const
 
 Tag Tagset::make_ign_tag() const
 {
+#ifndef _MSC_VER
 	mask_t ign_pos_mask = get_pos_mask("ign");
+#else //no const char* to std::string::const_iterator conversion
+	static const std::string ign("ign");
+	mask_t ign_pos_mask = get_pos_mask(ign);
+#endif
 	assert(ign_pos_mask.any());
 	return Tag(ign_pos_mask);
 }
diff --git a/libcorpus2/tagset.h b/libcorpus2/tagset.h
index 572e5b42b71eaade4cbd718cf2a8d1c7902b069d..a896d3481c53341309ea52bf34a3769b4d25b6b1 100644
--- a/libcorpus2/tagset.h
+++ b/libcorpus2/tagset.h
@@ -135,7 +135,11 @@ public:
 	 */
 	void parse_tag(const char* c, bool allow_extra,
 			boost::function<void (const Tag&)> sink) const {
+#ifndef _MSC_VER
 		parse_tag(std::make_pair(c, c + strlen(c)), allow_extra, sink);
+#else // no const char* to std::string::const_iterator conversion
+		parse_tag(std::string(c), allow_extra, sink);
+#endif
 	}
 
 	/**
@@ -174,7 +178,11 @@ public:
 	 * version.
 	 */
 	std::vector<Tag> parse_tag(const char* c, bool allow_extra) const {
+#ifndef _MSC_VER
 		return parse_tag(std::make_pair(c, c + strlen(c)), allow_extra);
+#else // no const char* to std::string::const_iterator conversion
+		return parse_tag(std::string(c), allow_extra);
+#endif
 	}
 
 	/**
@@ -201,8 +209,12 @@ public:
 	 * version.
 	 */
 	Tag parse_simple_tag(const char* c, bool allow_extra) const {
+#ifndef _MSC_VER
 		return parse_simple_tag(std::make_pair(c, c + strlen(c)),
 				allow_extra);
+#else // no const char* to std::string::const_iterator conversion
+		return parse_simple_tag(std::string(c), allow_extra);	
+#endif
 	}
 
 	/**
diff --git a/libcorpus2/util/tokentimer.cpp b/libcorpus2/util/tokentimer.cpp
index 293dcf54832973732aedc6f2f43bc2ef867b9924..4c2d948ad0542981809380847b315bec5d643b4a 100644
--- a/libcorpus2/util/tokentimer.cpp
+++ b/libcorpus2/util/tokentimer.cpp
@@ -56,10 +56,13 @@ namespace {
 
 void TokenTimer::register_signal_handler()
 {
+#ifdef SIGUSR1
 	struct sigaction s;
 	memset(&s, 0, sizeof(s));
 	s.sa_handler = &handler;
-	if (sigaction(SIGUSR1, &s, 0) != 0) {
+	if (sigaction(SIGUSR1, &s, 0) != 0)
+#endif
+	{
 		std::cerr << "Signal handler registration error\n";
 	}
 }
diff --git a/libpwrutils/CMakeLists.txt b/libpwrutils/CMakeLists.txt
index 84cbcc82e00246161e30dfcbe933624669c54daa..0e969a0a2f418c7db12c1a6abb8aa492c51464ad 100644
--- a/libpwrutils/CMakeLists.txt
+++ b/libpwrutils/CMakeLists.txt
@@ -34,7 +34,7 @@ SET(libpwrutils_STAT_SRC
 
 file(GLOB_RECURSE INCS "*.h")
 
-add_library(pwrutils SHARED ${libpwrutils_STAT_SRC} ${INCS})
+add_library(pwrutils ${libpwrutils_STAT_SRC} ${INCS})
 target_link_libraries(pwrutils ${LIBS} )
 set_target_properties(pwrutils PROPERTIES
 	VERSION "${pwrutils_ver_major}.${pwrutils_ver_minor}"
diff --git a/libpwrutils/bitset.h b/libpwrutils/bitset.h
index f62feeb1bdefce72435d49b08088d596bf3f5c94..439a23cda7ad8874999c24582ec148562eef1530 100644
--- a/libpwrutils/bitset.h
+++ b/libpwrutils/bitset.h
@@ -8,6 +8,10 @@
 #include <boost/pending/lowest_bit.hpp>
 #include <climits>
 
+#ifdef _MSC_VER
+#include <intrin.h>
+#pragma intrinsic(_BitScanForward)
+#endif
 
 namespace PwrNlp {
 
@@ -37,13 +41,6 @@ size_t count_bits_set(const std::bitset<S>& b)
 	return b.count();
 }
 
-template <size_t S> inline
-size_t lowest_bit(const bitset<S>& b)
-{
-	// GCC specific
-	return b._Find_first();
-}
-
 /**
  * Get index of lowest set bit in an integral type
  */
@@ -55,8 +52,49 @@ inline size_t lowest_bit(const unsigned long long& t)
 
 inline size_t lowest_bit(const unsigned long& t)
 {
+#ifndef _MSC_VER
 	if (t <= 0) return static_cast<size_t>(-1);
 	return boost::lowest_bit(t);
+#else
+	unsigned long index = 0;
+	if(_BitScanForward(&index, t)) return index;
+	return static_cast<size_t>(-1);
+#endif
+}
+
+template <size_t S> inline
+size_t lowest_bit(const bitset<S>& b)
+{
+#ifdef __GNUC__
+	return b._Find_first();
+#elif _MSC_VER
+	for(size_t w = 0; w <= S / ulong_bits; ++w) {
+		unsigned long index = 0;
+		if(_BitScanForward(&index, b._Getword(w))) {
+			return index + w * PwrNlp::ulong_bits;
+		}
+	}
+	return static_cast<size_t>(-1);
+#else
+	if(b.none()) return static_cast<size_t>(-1);
+	
+	const bitset<S> mask(std::numeric_limits<unsigned long>::max());
+	bitset<S> c(b);
+	unsigned long offset = 0;
+	unsigned long ul = (c & mask).to_ulong(); 
+	while(ul == 0) {
+		c >>= PwrNlp::ulong_bits;
+		offset += PwrNlp::ulong_bits;
+		ul = (c & mask).to_ulong(); 
+	}
+	return lowest_bit(ul) + offset;
+#endif
+}
+
+template<> inline
+size_t lowest_bit(const word_bitset& b)
+{
+	return lowest_bit(b.to_ulong());
 }
 
 /// Helper iterator class for iterating through set bits