Re: freetds-current on win32

Damien Churchill <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On 11 May 2010 22:13, Paul Thurston <[email protected]> wrote:
> Apparently, Damien has a collection of fixed which allow compilation of the build.
>

Indeed I have. I've attached a diff of the changes I have made in
order to facilitate compilation using VS2008 on Windows 7, 32 bit.

However this produces static libs that are very large in size and I
don't know how to fix it.

db-lib.lib - 2,207kb
TDS.lib - 1,164kb
replacements.lib - 372kb

So any pointers in that direction would be greatly appreciated!

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
freetds-current.diff (text/x-patch, 11.3 KB)
diff --git a/FreeTDS.sln b/FreeTDS.sln
index 432ea3a..dc95853 100755
--- a/FreeTDS.sln
+++ b/FreeTDS.sln
@@ -1,6 +1,6 @@
 
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TDS", "src\tds\TDS.vcproj", "{B9D6D61B-5E3B-42F4-A758-7A137594E3E9}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "db-lib", "src\dblib\db-lib.vcproj", "{F3CDE19D-7E97-4874-8E9F-994A82CDBDDA}"
diff --git a/include/fakepoll.h b/include/fakepoll.h
index 74cd7d4..879cee9 100644
--- a/include/fakepoll.h
+++ b/include/fakepoll.h
@@ -30,6 +30,7 @@
 #define FD_SETSIZE OPEN_MAX
 #endif
 
+#if !defined(_WIN32)
 // poll flags
 #define POLLIN  0x0001
 #define POLLOUT 0x0004
@@ -47,6 +48,7 @@
 #define POLLHUP 0x0010
 #define POLLNVAL 0x0020
 
+
 typedef struct pollfd {
     int fd;		/* file descriptor to poll */
     short events;	/* events of interest on fd */
@@ -55,5 +57,6 @@ typedef struct pollfd {
 
 
 int fakepoll(struct pollfd fds[], int nfds, int timeout);
+#endif
 
 #endif
diff --git a/src/dblib/db-lib.vcproj b/src/dblib/db-lib.vcproj
index 9c2817b..6be0d51 100755
--- a/src/dblib/db-lib.vcproj
+++ b/src/dblib/db-lib.vcproj
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="8.00"
+	Version="9.00"
 	Name="db-lib"
 	ProjectGUID="{F3CDE19D-7E97-4874-8E9F-994A82CDBDDA}"
 	RootNamespace="dblib"
+	TargetFrameworkVersion="131072"
 	>
 	<Platforms>
 		<Platform
@@ -84,11 +85,12 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="4"
 			CharacterSet="2"
+			WholeProgramOptimization="1"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
@@ -104,22 +106,15 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="0"
 				AdditionalIncludeDirectories="..\..\win32;..\..\include"
-				PreprocessorDefinitions="WIN64;HAVE_CONFIG_H;_FREETDS_LIBRARY_SOURCE;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
-				MinimalRebuild="true"
-				ExceptionHandling="0"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				BrowseInformation="1"
+				PreprocessorDefinitions="WIN32;HAVE_CONFIG_H;_FREETDS_LIBRARY_SOURCE;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
+				RuntimeLibrary="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
-				CompileAs="1"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -148,18 +143,14 @@
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"
-				Description="Building dblib.lib using FreeTDS"
-				CommandLine="lib -OUT:dblib.lib ..\tds\$(IntDir)\db-lib.lib ../tds/$(IntDir)/db-lib.lib ../replacements/$(IntDir)/db-lib.lib  "
-				ExcludedFromBuild="true"
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
 			CharacterSet="2"
-			WholeProgramOptimization="1"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
@@ -175,15 +166,22 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
+				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\..\win32;..\..\include"
-				PreprocessorDefinitions="WIN32;HAVE_CONFIG_H;_FREETDS_LIBRARY_SOURCE;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
-				RuntimeLibrary="0"
+				PreprocessorDefinitions="WIN64;HAVE_CONFIG_H;_FREETDS_LIBRARY_SOURCE;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
+				MinimalRebuild="true"
+				ExceptionHandling="0"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				BrowseInformation="1"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
+				CompileAs="1"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -212,6 +210,9 @@
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"
+				Description="Building dblib.lib using FreeTDS"
+				CommandLine="lib -OUT:dblib.lib ..\tds\$(IntDir)\db-lib.lib ../tds/$(IntDir)/db-lib.lib ../replacements/$(IntDir)/db-lib.lib  "
+				ExcludedFromBuild="true"
 			/>
 		</Configuration>
 		<Configuration
diff --git a/src/replacements/replacements.vcproj b/src/replacements/replacements.vcproj
index 2e5f922..39bc61c 100755
--- a/src/replacements/replacements.vcproj
+++ b/src/replacements/replacements.vcproj
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="8.00"
+	Version="9.00"
 	Name="replacements"
 	ProjectGUID="{A7619118-36E9-434B-A87E-DBDEC14CF137}"
 	RootNamespace="replacements"
+	TargetFrameworkVersion="131072"
 	>
 	<Platforms>
 		<Platform
@@ -80,11 +81,12 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			Name="Release|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="4"
 			CharacterSet="2"
+			WholeProgramOptimization="1"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
@@ -100,16 +102,12 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="0"
 				AdditionalIncludeDirectories="..\..\win32;..\..\include"
-				PreprocessorDefinitions="WIN64;HAVE_CONFIG_H;_FREETDS_LIBRARY_SOURCE;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
+				PreprocessorDefinitions="WIN32;HAVE_CONFIG_H;_FREETDS_LIBRARY_SOURCE;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
+				RuntimeLibrary="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
@@ -143,12 +141,11 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
 			CharacterSet="2"
-			WholeProgramOptimization="1"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
@@ -164,12 +161,16 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
+				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\..\win32;..\..\include"
-				PreprocessorDefinitions="WIN32;HAVE_CONFIG_H;_FREETDS_LIBRARY_SOURCE;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
-				RuntimeLibrary="0"
+				PreprocessorDefinitions="WIN64;HAVE_CONFIG_H;_FREETDS_LIBRARY_SOURCE;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
@@ -304,7 +305,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|x64"
+					Name="Release|Win32"
 					ExcludedFromBuild="true"
 					>
 					<Tool
@@ -312,7 +313,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Release|Win32"
+					Name="Debug|x64"
 					ExcludedFromBuild="true"
 					>
 					<Tool
diff --git a/src/tds/TDS.vcproj b/src/tds/TDS.vcproj
index 5e8f110..6bb9bdc 100755
--- a/src/tds/TDS.vcproj
+++ b/src/tds/TDS.vcproj
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="8.00"
+	Version="9.00"
 	Name="TDS"
 	ProjectGUID="{B9D6D61B-5E3B-42F4-A758-7A137594E3E9}"
 	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
 	>
 	<Platforms>
 		<Platform
@@ -42,7 +43,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\..\win32;..\..\include"
-				PreprocessorDefinitions="WIN32;HAVE_CONFIG_H;_FREETDS_LIBRARY_SOURCE;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
+				PreprocessorDefinitions="WIN32;HAVE_CONFIG_H;_FREETDS_LIBRARY_SOURCE;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;USE_NODELAY"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="1"
@@ -81,9 +82,9 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
 			ConfigurationType="4"
 			>
 			<Tool
@@ -100,23 +101,16 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="0"
 				AdditionalIncludeDirectories="..\..\win32;..\..\include"
-				PreprocessorDefinitions="WIN64;HAVE_CONFIG_H;_FREETDS_LIBRARY_SOURCE;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
-				MinimalRebuild="true"
-				ExceptionHandling="0"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
+				PreprocessorDefinitions="USE_NODELAY;WIN32;HAVE_CONFIG_H;_FREETDS_LIBRARY_SOURCE;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
+				RuntimeLibrary="0"
 				UsePrecompiledHeader="0"
-				BrowseInformation="1"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
-				CompileAs="1"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -147,9 +141,9 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
 			>
 			<Tool
@@ -166,16 +160,23 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
+				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\..\win32;..\..\include"
-				PreprocessorDefinitions="WIN32;HAVE_CONFIG_H;_FREETDS_LIBRARY_SOURCE;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
-				RuntimeLibrary="0"
+				PreprocessorDefinitions="WIN64;HAVE_CONFIG_H;_FREETDS_LIBRARY_SOURCE;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
+				MinimalRebuild="true"
+				ExceptionHandling="0"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
 				UsePrecompiledHeader="0"
+				BrowseInformation="1"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
+				CompileAs="1"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
diff --git a/src/tds/net.c b/src/tds/net.c
index 953f576..5a07013 100644
--- a/src/tds/net.c
+++ b/src/tds/net.c
@@ -176,6 +176,9 @@ _tds_socket_done(void)
 #elif defined(__VMS)
 #define TCP_NODELAY 1
 #define USE_NODELAY 1
+#elif defined (_WIN32)
+#define SOL_TCP		6	/* TCP level */
+#define USE_NODELAY 1
 #endif
 
 #if !defined(_WIN32)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.