[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MinGW gai_strerror conflict
From: |
Yoann Vandoorselaere |
Subject: |
Re: MinGW gai_strerror conflict |
Date: |
Wed, 17 Jan 2007 14:15:23 +0100 |
Le mercredi 17 janvier 2007 à 13:57 +0100, Simon Josefsson a écrit :
> Yoann Vandoorselaere <address@hidden> writes:
>
> > Hi,
> >
> > This occur when trying to compile the getaddrinfo() module under MinGW:
> >
> > checking for library containing getaddrinfo... no
> > checking for getaddrinfo... no
> > checking for getaddrinfo in ws2tcpip.h and -lws2_32... yes
> > checking for gai_strerror... no
> > [...]
> > checking whether gai_strerror is declared... yes
> >
> >
> > gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -Wall
> > -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
> > -Wbad-function-cast -Wcast-qual -Wcast-align -Wnested-externs -Wunused
> > -MT gai_strerror.lo -MD -MP -MF .deps/gai_strerror.Tpo -c gai_strerror.c
> > -DDLL_EXPORT -DPIC -o .libs/gai_strerror.o
> > gai_strerror.c:68: conflicting types for `gai_strerrorA'
> > c:/MinGW/include/ws2tcpip.h:301: previous declaration of `gai_strerrorA'
>
> I don't get the same, I get:
>
> http://autobuild.josefsson.org/gnulib-mingw32/log-200701171211588110000.txt
>
> (Disregard the first ./configure output, it uses native cc.)
Different MinGW version? The user reporting the problem is using
MinGW-3.0.0.
> > The definition in ws2tcpip.h look like:
> >
> > char* WSAAPI gai_strerrorA(int);
> > WCHAR* WSAAPI gai_strerrorW(int);
> > #ifdef UNICODE
> > #define gai_strerror gai_strerrorW
> > #else
> > #define gai_strerror gai_strerrorA
> > #endif /* UNICODE */
> >
> >
> > As a result, shouldn't we always declare gai_strerror() in case the
> > function is missing but the declaration is available?
>
> I'm not sure how to handle this. Declaring the function doesn't seem
> like a solution, since it will still collide with their definition (we
> use 'const' and they don't, and they add 'WSAAPI', but the last part
> may not matter).
We could use a replacement function:
#undef gai_strerror
#define gai_strerror rpl_gai_strerror
Shouldn't we?
> However, perhaps the error is that getaddrinfo/gai_strerror is built
> at all on your system. mingw32 appear to have working getaddrinfo, so
> we shouldn't need to build anything.
getaddrinfo() seem to be working (and the module handle that part fine),
but there is no gai_strerror() symbol available, which is a requirement
in an environment using getaddrinfo(), thus we should compile the
replacement function.
Regards,
--
Yoann Vandoorselaere | Responsable R&D / CTO | PreludeIDS Technologies
Tel: +33 (0)8 70 70 21 58 Fax: +33(0)4 78 42 21 58
http://www.prelude-ids.com