diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 42ee9d1..6678504 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -180,17 +180,17 @@ ELSE()
    SET(EMOCK_SRCS ${EMOCK_SRCS} ports/failure/stdexcept_report_failure.cpp)
 ENDIF()
 
-IF(MSVC)
+IF(WIN32)
    SET(EMOCK_SRCS 
        ${EMOCK_SRCS} 
        WinCodeModifier.cpp
-   ) 
-ELSE(MSVC)
+   )
+ELSE()
    SET(EMOCK_SRCS 
        ${EMOCK_SRCS} 
        UnixCodeModifier.cpp
    )
-ENDIF(MSVC)
+ENDIF()
 ######################################################
 SET(EMOCK_HEADERS_PATH ${EMOCK_SRC_ROOT}/include/emock)
 
@@ -205,8 +205,8 @@ INSTALL(
    TARGETS emock
    ARCHIVE DESTINATION lib)
 
-IF(MSVC)
+IF(0)
 INSTALL(
    FILES ${CMAKE_BINARY_DIR}/src/Debug/emock.pdb
    DESTINATION lib)
-ENDIF(MSVC)
+ENDIF()
diff --git a/src/Formatter.cpp b/src/Formatter.cpp
index 4a117ad..1858fe4 100644
--- a/src/Formatter.cpp
+++ b/src/Formatter.cpp
@@ -26,6 +26,16 @@
 #include <emock/OutputStringStream.h>
 #include <emock/Formatter.h>
 
+#ifdef _MSC_VER
+    #ifdef _WIN64 // [
+        typedef unsigned __int64  uintptr_t;
+    #else // _WIN64 ][
+        typedef _W64 unsigned int uintptr_t;
+    #endif // _WIN64 ]
+#else
+   #include <inttypes.h>
+#endif
+
 EMOCK_NS_START
 
 //////////////////////////////////////////
@@ -38,7 +48,7 @@ std::string toPointerString(void* p)
    oss << "0x";
    oss.flags (std::ios::hex);
    oss.fill('0'); oss.width(8);
-   oss << reinterpret_cast<unsigned long>(p);
+   oss << reinterpret_cast<uintptr_t>(p);
 
    return oss.str();
 }
diff --git a/src/SymbolRetriever.cpp b/src/SymbolRetriever.cpp
index fe643da..1c38eea 100644
--- a/src/SymbolRetriever.cpp
+++ b/src/SymbolRetriever.cpp
@@ -15,12 +15,11 @@
 #include <emock/TypeString.h>
 #include <emock/ReportFailure.h>
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) ||  defined(__MINGW32__)
 
 	#include <windows.h>
 	#include <dbghelp.h>
     #include <vector>
-	#pragma comment(lib, "Dbghelp.lib")
 
     #ifdef _WIN64 // [
         typedef unsigned __int64  uintptr_t;
@@ -37,17 +36,20 @@
 	#include <unistd.h>
 	#include <cassert>
 	#include <stdio.h>
+    #include <dlfcn.h>
     #if __APPLE__
         #include <mach-o/dyld.h>
         #include <mach-o/dyld_images.h>
         #include <mach-o/fat.h>
         #include <mach-o/nlist.h>
-        #include <dlfcn.h>
         #include <ar.h>
         #include <limits.h>
-    #else
-	    #include <link.h>
+    #elif defined(__linux__)
+        #include <link.h>
         #include <linux/limits.h>
+    #else
+        #include <link.h>
+        #include <limits.h>
     #endif
 
 #endif
@@ -94,7 +96,7 @@ EMOCK_NS_START
             return stringify.substr(start, stringify.find_last_not_of(')') - start + 1);
         }
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) ||  defined(__MINGW32__)
         static std::string extractMethodSignatureName(const char* pmf_info, std::string& symbolName, const std::string& stringify) {
 #else
         static std::string extractMethodSignatureName(const char* pmf_info, const std::string& stringify) {
@@ -107,7 +109,7 @@ EMOCK_NS_START
                     std::string ret(from, pmf_info - from - 1);
                     ret += extractMethodName(stringify);
                     // extract symbol name
-#ifdef _MSC_VER
+#if defined(_MSC_VER) ||  defined(__MINGW32__)
                     symbolName = strchr(ret.c_str(), ' ') + 1;
 #endif
                     // extract arg list
@@ -134,7 +136,7 @@ EMOCK_NS_START
         }
     }
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) ||  defined(__MINGW32__)
 
     std::map<std::pair<ULONG64, std::string>, std::map<int, std::string> > g_symbolCache;
     void SymbolRetriever::reset() {
@@ -188,7 +190,16 @@ EMOCK_NS_START
                 }
                 else {
                     char filePath[MAX_PATH] = {0};
-                    if(SymGetSymbolFile(GetCurrentProcess(), NULL, moduleInfo.ImageName, sfPdb, filePath, MAX_PATH, filePath, MAX_PATH))
+                    /*
+                    typedef enum {
+                        sfImage = 0,
+                        sfDbg,
+                        sfPdb,
+                        sfMpd,
+                        sfMax
+                    } IMAGEHLP_SF_TYPE;
+                    */
+                    if(SymGetSymbolFile(GetCurrentProcess(), NULL, moduleInfo.ImageName, 2/*sfPdb*/, filePath, MAX_PATH, filePath, MAX_PATH))
                         return filePath;
                 }
             }
diff --git a/src/Trampoline.cpp b/src/Trampoline.cpp
index 52116da..d378ffb 100644
--- a/src/Trampoline.cpp
+++ b/src/Trampoline.cpp
@@ -14,7 +14,7 @@
 #include <emock/ReportFailure.h>
 #include <emock/ArgumentsMacroHelpers.h>
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) ||  defined(__MINGW32__)
 
     #include <windows.h>
 	#include <cassert>
@@ -35,13 +35,19 @@
         #include <limits.h>
         #include <mach/mach_vm.h>
         #include <mach/mach_init.h>
-    #else
+    #elif defined(__linux__)
         #include <linux/limits.h>
+    #else
+        #include <limits.h>
 
     #endif
 
 #endif
 
+#ifndef MAP_NORESERVE
+#define MAP_NORESERVE 0
+#endif
+
 EMOCK_NS_START
 
 namespace {
@@ -62,7 +68,7 @@ static const size_t kMaxAllocationDelta = 0x80000000; // 2GB
 static const size_t kAllocationSize     = EMOCK_PAGE_SIZE;  // 4KB
 static const size_t kAlignmentSize      = 64;         // 64
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) ||  defined(__MINGW32__)
 
     #if BUILD_FOR_X64
         #define _ADDRESS_MAX_VALUE 0x80000000000
@@ -105,7 +111,7 @@ static const size_t kAlignmentSize      = 64;         // 64
 
         if (allocated)
         {
-            if (std::abs((long)dst - (long)allocated) > kMaxAllocationDelta)
+            if (std::abs((int64_t)dst - (int64_t)allocated) > kMaxAllocationDelta)
             {
                 VirtualFree(allocated, 0, MEM_RELEASE);
                 return NULL;
@@ -284,7 +290,7 @@ static const size_t kAlignmentSize      = 64;         // 64
     }
 
     void* Trampoline::get4MemFunc(const void* src, void* dst) {
-#ifdef _MSC_VER
+#if defined(_MSC_VER) ||  defined(__MINGW32__)
         static const unsigned char ecxToArgList[] = { 0x58, 0x51, 0x50 };
         // apply trampoline and push ecx
     #if BUILD_FOR_X64
