[Top][All Lists]

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

Re: replace gai_strerror on mingw?

From: Simon Josefsson
Subject: Re: replace gai_strerror on mingw?
Date: Fri, 29 Apr 2011 09:17:59 +0200
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/23.2 (gnu/linux)

Eric Blake <address@hidden> writes:

> 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

Improving this seems like a good idea to me.

Couldn't you use the same approach as getaddrinfo.c does to find the
function?  Mingw's inline prototype seems unfortunate, and I'm not sure
why it works that way -- I believe gai_strerror is a real function on

Also, there IS a lib/gai_strerror.c, isn't it used?


reply via email to

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