Cygwin Build Bug (Probably Affects other GNU GLIBC Builds)

Brent Fulgham brent.fulgham@xpsystems.com
Wed, 23 May 2001 14:56:19 -0700


For thread-safety reasons, the GNU C Library (2.2+) defines "errno"
as a macro that calls a function to get the errno of the current thread.
Consequently, the source file "src/runtime/Builtin/cIOExtras.c" needs
to include the <errno.h> header file, rather than declaring an extern
variable.

Diff:
==========================================================================

*** cIOExtras.old.c	Wed May 23 14:54:58 2001
--- cIOExtras.c	Wed May 23 14:26:54 2001
***************
*** 1,10 ****
  /* basic unsafe utilities, defined in IOExtras */
  #include "cinterface.h"
  #include "mk.h"
  
  void   performGC         ()                     { C_GC(0); }
  int    unsafePtrEq       (void* a, void* b)     { return (a==b); }
  
  /* basic error handling via C's errno */
! extern int errno;
  int	getErrNo	(void)			{ return errno; }
--- 1,11 ----
  /* basic unsafe utilities, defined in IOExtras */
  #include "cinterface.h"
  #include "mk.h"
+ #include "errno.h"
  
  void   performGC         ()                     { C_GC(0); }
  int    unsafePtrEq       (void* a, void* b)     { return (a==b); }
  
  /* basic error handling via C's errno */
! /*extern int errno;*/
  int	getErrNo	(void)			{ return errno; }