diff --git a/config/common.sh b/config/common.sh
index 81b0448..22c89a1 100644
--- a/config/common.sh
+++ b/config/common.sh
@@ -17,7 +17,7 @@ set_platform() {
         platform=`uname`
         case "$platform" in
             CYGWIN* ) PLATFORM=cygwin-i686-gcc ;;
-            MINGW* ) PLATFORM=mingw-i686-gcc ;;
+            MINGW* ) PLATFORM=mingw-w64-i686-gcc ;;
             HP-UX ) PLATFORM=hpux-hppa-aCC ;;
             Linux ) PLATFORM=linux-i686-gcc ;;
             SunOS ) PLATFORM=solaris-sparc-CC ;;
diff --git a/config/mingw-w64-i686-gcc.inc b/config/mingw-w64-i686-gcc.inc
new file mode 100644
index 0000000..76ede57
--- /dev/null
+++ b/config/mingw-w64-i686-gcc.inc
@@ -0,0 +1,11 @@
+# Written for GNU -*- makefile -*-.
+
+include ../config/gcc.inc
+MAKEFILEDEPS += ../config/gcc.inc
+
+CC += -mno-cygwin -DDTL_MINGW32 -DDTL_MINGW64
+#CC += -march=i686 -mwin32 -DWIN32 -I.  
+LDLIBS += -lodbc32 -lodbccp32
+
+# Windows extensions for executables
+EXE = .exe
diff --git a/lib/DBStmt.cpp b/lib/DBStmt.cpp
index 32032c2..55562e6 100644
--- a/lib/DBStmt.cpp
+++ b/lib/DBStmt.cpp
@@ -903,7 +903,7 @@ SQLINTEGER FetchOffset)
 			    (SQLSMALLINT) InputOutputType, (SQLSMALLINT) ValueType,
 				(SQLSMALLINT) ParameterType, (SQLUINTEGER) ColumnSize,
 				(SQLSMALLINT) DecimalDigits, (SQLPOINTER) ParameterValuePtr, 
-				(SQLINTEGER) BufferLength, (SQLINTEGER *) StrLen_or_IndPtr);
+				(SQLINTEGER) BufferLength, (SQLLEN *) StrLen_or_IndPtr);
 
 	      if (!RC_SUCCESS(rc))
 		  {
@@ -956,7 +956,7 @@ SQLINTEGER FetchOffset)
 	      RETCODE rc = SQLBindCol((SQLHSTMT) hstmt,
 			    (SQLUSMALLINT) ColumnNumber + 1,
 			    (SQLSMALLINT) TargetType, (SQLPOINTER) TargetValuePtr, 
-				(SQLINTEGER) BufferLength, (SQLINTEGER *) StrLen_or_IndPtr);
+				(SQLINTEGER) BufferLength, (SQLLEN *) StrLen_or_IndPtr);
 
 	      if (!RC_SUCCESS(rc))
 		  {
@@ -1009,7 +1009,7 @@ SQLINTEGER FetchOffset)
 	      RETCODE rc = SQLGetData((SQLHSTMT) hstmt,
 			    (SQLUSMALLINT) ColumnNumber + 1,
 			    (SQLSMALLINT) TargetType, (SQLPOINTER) TargetValuePtr, 
-				(SQLINTEGER) BufferLength, (SQLINTEGER *) StrLen_or_IndPtr);
+				(SQLINTEGER) BufferLength, (SQLLEN *) StrLen_or_IndPtr);
 
 	      if (!RC_SUCCESS(rc)  && rc != SQL_NO_DATA)
 		  {
@@ -1140,7 +1140,7 @@ SQLINTEGER FetchOffset)
 		if (!IsReady() && valid())
 			const_cast<DBStmt *>(this)->Initialize();
 
-		SQLINTEGER result;
+		SQLLEN result;
 
 		assert(hstmt != SQL_NULL_HSTMT);
 
@@ -1291,7 +1291,7 @@ SQLINTEGER FetchOffset)
 		TCHAR   szPkCol[COL_LEN];  /* Primary key column   */
 		
 		SQLHSTMT         hstmt;
-		SQLINTEGER      cbPkCol;
+		SQLLEN      cbPkCol;
 		
 		SQLRETURN         retcode;
 
diff --git a/lib/RootException.h b/lib/RootException.h
index c1c5a41..3a822b0 100644
--- a/lib/RootException.h
+++ b/lib/RootException.h
@@ -28,6 +28,10 @@ It is provided "as is" without express or implied warranty.
 #include <exception>
 #include "std_warn_on.h"
 
+#ifdef DTL_MINGW64
+	#include <typeinfo>
+#endif
+
 #include "clib_fwd.h"
 BEGIN_DTL_NAMESPACE
 
diff --git a/lib/bind_basics.cpp b/lib/bind_basics.cpp
index a1315a2..e3e049e 100644
--- a/lib/bind_basics.cpp
+++ b/lib/bind_basics.cpp
@@ -497,7 +497,8 @@ void resolve_duplicates (DBConnection& conn, DBStmt &stmt, STD_::vector<tstring>
 	const int MAX_COLNAME = 50;
 	RETCODE rc;
 	TCHAR szTableName[MAX_COLNAME + 1];
-	SQLSMALLINT cbTableName, dummy;
+	SQLSMALLINT cbTableName;
+	SQLLEN dummy;
 	HSTMT hstmt = GetHSTMT(stmt);
 	int i;
 	tstring tmp, dot = _TEXT (".");
@@ -560,7 +561,7 @@ void DescColsOrParams(DBConnection& conn, DBStmt &stmt, STD_::vector<TypeTransla
   TCHAR szColName[MAX_COLNAME + 1];
   SQLSMALLINT cbColName;
   SQLSMALLINT fSQLType;
-  SQLUINTEGER cbPrec;
+  SQLULEN cbPrec;
   SQLSMALLINT cbScale;
   SQLSMALLINT fNullable;
   RETCODE rc;
@@ -592,7 +593,9 @@ void DescColsOrParams(DBConnection& conn, DBStmt &stmt, STD_::vector<TypeTransla
 
 	}
 	else
+	{
 		rc = SQLDescribeParam (hstmt, i, &fSQLType, &cbPrec, &cbScale, &fNullable);
+	}
 	
     if (!RC_SUCCESS (rc))
 	  if (!get_cols)
@@ -772,7 +775,8 @@ GetFieldInfo (const tstring& TableName, tstring& TableFields,
       TCHAR szPkCol[COL_LEN];  // Primary key column
 
       SQLHSTMT spec_hstmt;
-      SQLINTEGER cbPkCol, cbSQLType;
+      SQLLEN cbPkCol;
+      SQLLEN cbSQLType;
 
       SQLRETURN retcode = SQLAllocStmt (conn.GetHDBC ( ), &spec_hstmt);
 
diff --git a/lib/debug/BoundIO.d b/lib/debug/BoundIO.d
deleted file mode 100644
index 4fc9fcc..0000000
--- a/lib/debug/BoundIO.d
+++ /dev/null
@@ -1,5 +0,0 @@
-debug/BoundIO.o: BoundIO.cpp BoundIO.h DB_Base.h dtl_base_types.h \
- dtl_config.h std_warn_off.h std_warn_on.h unix_tchar.h bind_basics.h \
- RootException.h CountedPtr.h clib_fwd.h minimax.h array_string.h \
- date_util.h variant_row.h VariantException.h DBException.h string_util.h \
- DBConnection.h validate.h DBStmt.h
diff --git a/lib/dtl_config.h b/lib/dtl_config.h
index 6b8b810..05f0de1 100644
--- a/lib/dtl_config.h
+++ b/lib/dtl_config.h
@@ -16,6 +16,11 @@ It is provided "as is" without express or implied warranty.
 #ifndef DTL_DTL_CONFIG_H
 #define DTL_DTL_CONFIG_H
 
+#ifdef DTL_MINGW64
+#include <windows.h>
+#define DTL_NATIVE_WIN32
+#endif // DTL_MINGW64
+
 // Be more specific about WIN32 support.
 // MinGW defines WIN32, but we want it to behave basically like native GCC.
 #if !defined(__MINGW32__)
@@ -208,6 +213,9 @@ DynamicIndexedDBView<view_type, \
 
 #if defined(DTL_NATIVE_WIN32) 
 #  include <tchar.h>
+// Required for GCC 4.4 and above
+#  include <typeinfo>
+#  include <limits.h>
 #else
 #  include "unix_tchar.h"
 #endif
