Subject: Re: undefined errno in libftp
From: [email-masked] (Richard H. Gumpertz)

6 Mar 1998 22:14:14 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
To: [email-masked]
Cc: [email-masked]

> Hello,
> 
> I am trying to build the Library for ftpd clients (libftp) from Oleg Orel 
> in Windows NT ( SP3 ). I built it in Solaris with no problem but when I 
> build it in windows NT I get the next error;
> 
> FtpLibrary.h:105: field `__errno' declared as a function
> 
> There is a struct;
> 
> typedef struct/* All structure initialize from edited struct FtpInit */
> {
> ...
> 
> int errno;        /* Last error code */  ( FtpLibrary.h:105)
> 
> ...
> }
> 
> If I add the next code to the FtpLibrary.h
> 
> #ifndef __CYGWIN32__
> extern int errno;
> #else
> #include <errno.h>
> #endif
> 
> I can build the library, but when I try to build a program I get the next 
> message:
> 
> FtpLogin.c:70: undefined reference to `errno'
> 
> Does anybody know what it happens ?

The problem is that C allows errno to be implemented as a macro rather than
an extern.  This is important for thread-safe code and a variety of other
things.  Avoid using the name errno in any context like that struct and you
should be OK.  In other words, the bug is in the file you are trying to
compile.

-- 
 =============================================================================
 |Richard H. Gumpertz [email-masked]  VOICE: (913) 642-1777  FAX: (913) 642-8777|
 |Computer Problem Solving 4518 W 89th St, Ste 220, Prairie Vlg KS 66207-2293|
 =============================================================================
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".