This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Undefined reference to 'gethostent'


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]