[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

replace gai_strerror on mingw?

From: Eric Blake
Subject: replace gai_strerror on mingw?
Date: Thu, 28 Apr 2011 15:43:40 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9

On mingw, gai_strerror has two different return types, depending on
whether UNICODE was defined at the time the header was included.  Both
types (char* and WCHAR*) are incompatible with the POSIX return type of
const char*.  Furthermore, a WCHAR* return renders the return string
worthless for an application that is not expecting unicode (you'd get
one byte).  It doesn't help that on mingw, gai_strerror is declared as
an inline function in the header, rather than declared as a function
with external linkage.

Should we always be replacing gai_strerror on mingw, and having the
replacement call gai_strerrorA to guarantee ASCII results and the right
return type?

Noticed by Matthias Bolte as a build warning of libvirt on mingw:

test-getaddrinfo.c:28:1: warning: initialization from incompatible
pointer type

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]