[PATCH 64bit] Export <io.h> symbols with underscore

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Feb 22 08:00:00 GMT 2013

On Feb 22 01:51, Christopher Faylor wrote:
> On Fri, Feb 22, 2013 at 12:18:48AM -0600, Yaakov wrote:
> >On Thu, 21 Feb 2013 14:42:36 -0500, Christopher Faylor wrote:
> >> I wasn't fulling grokking the fact that Cygwin explicitly defined the
> >> get_osfhandle without an underscore in io.h.  Sigh.  That's probably my
> >> fault too.
> >> 
> >> But we definitely shouldn't be going back to adding "_" decorations.  I
> >> have deleted a few of these and no one has complained.  I know that
> >> isn't a scientific sampling but it's hard to believe that someone has
> >> written code which actually goes out of its way to prepend an underscore
> >> in front of a standard UNIX function name, especially since we do not,
> >> AFAIK, define these functions in any header file.
> >> 
> >> So, I guess I don't understand why we need to add an underscore now
> >> when we have gotten by with the incorrect declaration for get_osfhandle
> >> all of these years.
> >
> >Because even if it caused a warning in C, the link still succeeded with
> >the underscored symbol.
> Ok.  I think we should also change io.h to only define _get_osfhandle on
> both 64-bit and the trunk version of cygwin.  Ditto for _setmode.  And,
> IMO, the access() declaration should be removed from io.h entirely.

access should go, no doubt about it.

For get_osfhandle and setmode I would prefer maintaining backward
compatibility with existing applications.  Both variations, with and
without underscore are definitely in use.

What about exporting the underscored variants only, but define the
non-underscored ones:

  extern long _get_osfhandle(int);
  #define get_osfhandle(i) _get_osfhandle(i)

  extern int _setmode (int __fd, int __mode);
  #define setmode(f,m) _setmode((f),(m))


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-patches mailing list