This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: Undefined reference to 'gethostent'
- To: Matthew Golzari <consultancy@golzari.nl>
- Subject: Re: Undefined reference to 'gethostent'
- From: Mumit Khan <khan@xraylith.wisc.EDU>
- Date: Sun, 23 May 1999 17:37:55 -0500 (CDT)
- cc: cygwin@sourceware.cygnus.com
On Mon, 24 May 1999, Matthew Golzari wrote:
> During linking the next line:
> $ gcc -o test test.o
>
> I get the following error message:
> test.o(.text+0x387):test.c: undefined reference to 'gethostent'
> collect2: Id returned 1 exit status
That's because gethostent doesn't exist in Cygwin. Unless you really
need to enumerate *all* the hosts in the database, this routine has
no place in networking code! These are especialy bad since the usual
implementations of these interfaces are not re-entrant.
Can you not use gethostbyname, gethostbyaddr, etc interfaces that
are implemented in Cygwin?
I'll see if I can dig up my old gethostent/sethostent/endhostent
implementations; if it's still on disk, I'll clean it up and
contribute.
There are very good sources of information that may help in writing
portable networking code. Unix Network Programming by W. Richard
Stevens is an excellent reference. Advanced Programming in the
UNIX Environment by the same author is also a must-have resource.
Regards,
Mumit
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com