delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/05/23/19:44:40

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
From: Mumit Khan <khan AT xraylith DOT wisc DOT EDU>
X-Authentication-Warning: mercury.xraylith.wisc.edu: khan owned process doing -bs
Date: Sun, 23 May 1999 17:37:55 -0500 (CDT)
To: Matthew Golzari <consultancy AT golzari DOT nl>
cc: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: Undefined reference to 'gethostent'
In-Reply-To: <37488152.96A1D854@golzari.nl>
Message-ID: <Pine.LNX.3.96.990523172349.9224A-100000@mercury.xraylith.wisc.edu>
MIME-Version: 1.0

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 AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019