2010/1/26 Chris Spencer <[email protected]>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi all,
>
> I'm having a bit of a problem with my networking code. Specifically, the
> linker can't find gai_strerror().
>
> To provide a very simple test case:
>
> #include <ws2tcpip.h>
> int main() {
>    gai_strerror(0);
>    return 0;
> }
>
> This compiles without issue in mingw32, but with mingw64 it fails:
>
> $ mingw32-gcc test.c
> $ x86_64-w64-mingw32-gcc test.c
> /tmp/ccfVhfda.o:test.c:(.text+0x13): undefined reference to `_gai_strerrorA'
> collect2: ld returned 1 exit status
>
> I can't really figure out what's going on here since it's defined inline
> in the header:
>
> WS2TCPIP_INLINE char *gai_strerrorA(int ecode) { ... }
>
> Any ideas?

Well, the symbol is part of the import-libary libws2_32.a. For me it
works to link, but I assume you are using an older version of our
runtime headers and crt, which could be the underlying issue. In our
trunk version we moved those function out exactly for this reason as
the inline versions can make troubles.
For fixing you issue, I would suggest to update mingw-w64 headers/crt,
or to take function gai_strerrorA and put it directly into your source
(of course without the WS2TCPIP_INLINE).

Regards,
Kai


-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to