freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
[freetds] API public header file on Windows with MS tools
- From: Ramiro Morales <cramm0 AT gmail.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: [freetds] API public header file on Windows with MS tools
- Date: Thu, 7 Jul 2011 14:46:55 -0300
Hi all,
I'm building FreeTDS 0.91dev for win32 using the MS C compliers included
with MS Visual Studio, using the Nmakefile.
Static libs and utility programs can be build without major problems.
But when trying to use the FreeTDS library in an application (see below)
using the same toolchains I get a lot of warnings and errors about
[clashing] re#definitions.
Collective wisdom about the platform and the tools says that kind of
problems with the win32 platform SDK headers files can be fixed by
modifying the win32/tds_sysdep_public.h file:
Index: win32/tds_sysdep_public.h
===================================================================
RCS file: /cvsroot/freetds/freetds/win32/tds_sysdep_public.h,v
retrieving revision 1.8
diff -u -r1.8 tds_sysdep_public.h
--- win32/tds_sysdep_public.h 16 Mar 2009 20:46:20 -0000 1.8
+++ win32/tds_sysdep_public.h 7 Jul 2011 17:15:51 -0000
@@ -28,6 +28,7 @@
{
#endif
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock2.h>
#define tds_sysdep_int16_type short /* 16-bit int */
WIN32_LEAN_AND_MEAN reduces the number of header files included by the
preprocessor (otherwise the error messages show e.g. clashing LPCBYTE
#define with e.g. a scard.h header file included with the MS SDK that is
related to a Smart Card API (!))
This has been tried with MS Visual Studio 2003 and 2008 (the two
compilers I have access to) and the problem is present and gets solved
with this change for both of them. I don't know if itis also needed (or
breaks things) for other MS compilers like Visual Studio 6, Visual
Studio 2002, 2005 and 2010.
The change doesn't affect building of FreeTDS.
Also, found another win32-with-MS-tools-only cosmetic fix:
Index: win32/config.h
===================================================================
RCS file: /cvsroot/freetds/freetds/win32/config.h,v
retrieving revision 1.18
diff -u -r1.18 config.h
--- win32/config.h 22 Oct 2010 20:14:53 -0000 1.18
+++ win32/config.h 7 Jul 2011 16:34:53 -0000
@@ -258,7 +258,7 @@
#define TDS_I64_FORMAT "I64d"
/* Version number of package */
-#define VERSION "0.83.dev"
+#define VERSION "0.91.dev"
Hopefully it will be updated to remove the "dev" suffix before FreeTDS
0.91 gets tagged.
Sorry for reporting things apiece like this, I'm slowly finding my way.
My final objective is to build latest [1]pymssql Python DB-API driver
for accessing MS SQL servers against FreeTDS but, to minimize chances of
future headaches, I'm not using mingw but the MS toolchain. Official
Python binaries on Windows are build using MS Visual Studio so I don't
want to mix object code created with different compilers.
I've already connected successfully from Python to a MS SQL Server 2000
instance. Will test things more thoroughly soon.
Thanks!
--
Ramiro Morales
1. http://code.google.com/p/pymssql/source/list
-
[freetds] API public header file on Windows with MS tools,
Ramiro Morales, 07/07/2011
-
Re: [freetds] API public header file on Windows with MS tools,
James K. Lowden, 07/07/2011
-
[freetds] Data Sources (ODBC) - Adding a new DSN entry,
Sergio NNX, 07/08/2011
- Re: [freetds] Data Sources (ODBC) - Adding a new DSN entry, Frediano Ziglio, 07/08/2011
- Re: [freetds] API public header file on Windows with MS tools, Frediano Ziglio, 07/08/2011
-
[freetds] Data Sources (ODBC) - Adding a new DSN entry,
Sergio NNX, 07/08/2011
-
Re: [freetds] API public header file on Windows with MS tools,
James K. Lowden, 07/07/2011
Archive powered by MHonArc 2.6.24.