Skip to Content.
Sympa Menu

freetds - Re: [freetds] API public header file on Windows with MS tools

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] API public header file on Windows with MS tools
  • Date: Thu, 4 Aug 2011 09:28:29 +0200

2011/8/3 Ramiro Morales <cramm0 AT gmail.com>:
> On Thu, Jul 7, 2011 at 11:04 PM, James K. Lowden <jklowden AT freetds.org>
> wrote:
>>> 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
>>
>> I'd like to deliberate on this a moment.
>>
>> I use Nmakefile fairly often, and sought to minimize the number of
>> preprocessor definitions.  I used WIN32_LEAN_AND_MEAN with Microsoft's
>> versions of sqlfront.h and sqldb.h, but haven't found it necessary with
>> FreeTDS.
>>
>> I'm using VS 2008, too.  I wonder what we're doing differently that
>> causes you a problem.
>>
>> If it turns out to be necessary to define WIN32_LEAN_AND_MEAN, I'd
>> prefer it not be in the .h file, but rather in the Nmakefile, as part
>> of the DEF macro, alongside all the other goofy arbitrariness.
>>
>
> [Unfortunately the version of VS 2008 bought here is in Spanish, even
> the command line tols messagesa re localized, and there is now way to
> force them e.g.  to English. That's why the errors below look so
> strange.]
>
> Fortunately the change that Frediano suggested in another message of
> this same thread and later [1][2]committed solved the particular LPCBYTE
> symbol clash with scard.h problem.
>
> The remaining errors (a bunch of them actually) when building the
> project that uses FreeTDS (pymssql) are about re-definitions of
> winsock-related symbols:
>
....
>
> (full build output at [3])
>
> Again, the traditionally suggested fix for that is to exchange the order
> of
>
>  #include <windows.h>
>  #include <winsock2.h>
>
> so the winsock2.h one goes first.
>

Done, we use same order in src/odbc/unittests/common.h

> I did so in win32/tds_sysdep_public.h and that allowed the build of
> pymssql to finish succesfully.
>
> Actually I suspect I could workaround this by adding a
>
>  #include <winsock2.h>
>
> befor
>
>  #include "sqlfront.h"
>

Should work too, if you are not able to get updated snapshot :)

> (and a #define WIN32_LEAN_AND_MEAN too if Frediano hand't modified that)
> in the relevant location (_mssql.c) of pymssql. But I'm curious about
> why e.g. you with VS 2008 and people using mingw and its version of the
> win32 header files haven't found the same problem. Maybe they workaround
> this particular win32 common development gotcha in another way?
>

Perhaps mingw define Windows socket in a coherent way :)

Personally I don't like to define WIN32_LEAN_AND_MEAN in a header
file, header should just work with or without this define and use
should select if it needs to use it.

> Regards,
>
> --
> Ramiro Morales
>

Frediano




Archive powered by MHonArc 2.6.24.

Top of Page