gcc 3.3 vs 3.4.4 - netdb.h different

Dave Korn dave.korn@artimi.com
Thu May 24 12:41:00 GMT 2007

On 23 May 2007 21:26, Karl Kobata wrote:

> I am compiling an application found on sourceforge that was compile on
> cygwin using gcc 3.3.  Since we are compiling all of our application with
> gcc 3.4.4, I am recompiling the application and find that it is not able to
> find int declarations such as getnetbyname_r or gethostbyaddr_r or
> gethostbyname_r and others that did exist in netdb.h.

  This is nothing to do with the compiler.  That file is part of the main
cygwin package itself.  AFAIK, cygwin supports only gethostbyaddr and
gethostbyname, in their plain forms, and not in the re-entrant _r versions.
>From a quick look at the code, these functions are thread-safe, having a
separate buffer for return results in each thread, but they will overwrite the
previous data each time called, so it does seem like you need to patch up the
code you're compiling to use the non-re-entrant versions, or provide your own
_r wrappers that call the non-_r version and then copy the returned result
into the provided buffer.  (Note that this is a little tricky because you have
to calculate the size of the returned data, but you could model your approach
on __dup_ent in net.cc in the cygwin source code).

Can't think of a witty .sigline today....

Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

More information about the Cygwin mailing list