www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/01/14:30:33

From: "John Luebs" <jkluebs AT dreamscape DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Winsock.h parse error problem
Date: 1 Jan 1998 19:24:54 GMT
Organization: Luebs & Son Photo
Lines: 54
Message-ID: <01bd16ea$7ed3a5c0$8713c6cf@comp>
References: <6852am$hkb$1 AT newsource DOT ihug DOT co DOT nz>
NNTP-Posting-Host: sa4-p7.dreamscape.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I have found quite a few replies that really have no relevancy to the
problem. The WIndows SDK wants to maintain backward compatibility. However
in this case you don't want to remove the FARs because of keeping the
compatibiliity. You will want to find where FAR is defined and add
something like #ifdef DJGPP #define FAR #endif This would keep
compatibility yet remove th need for fars, as they are frivolous in Win32
programming.

For more clarification the FAR definition was supposed to be defined to the
compiler specific directive that caused it to use a 32-bit pointer instead
of a 16-bit pointer (like in MSVC this was far (this was important in WIn16
days) For compatibility and porting ease, they kept the definition yet
since all pointers are 32-bit in 32-bit programming there is really no need
to explictily state that so we define the FAR to be nothing: #define FAR.

Hope this helps,
John Luebs

John Luebs

Thomas Mulgrew <no AT email DOT addr> wrote in article
<6852am$hkb$1 AT newsource DOT ihug DOT co DOT nz>...
> I'm completely new to socket programming (or windows for that matter),
and 
> having a bit of trouble getting started.
> 
> When I compile a file that #includes winsock.h (using gcc -Zwin32
prog.cpp -c 
> -o prog.o  or something along those lines), the compiler reports parse
errors 
> while in the winsock.h file.
> 
> Generated by lines like this:
> 
> struct hostent FAR * PASCAL FAR gethostbyname(const char FAR * name);
> 
> And the parse error is reported to be "before __attribute__"
> 
> I'm not exactly sure what FAR means in a 32bit addressing mode context,
but 
> that aside I believe the line is declaring a function 'gethostbyname', to
be 
> called using the pascal calling convention, and which returns a pointer
to a 
> hostent structure.
> 
> What I would like to know is: what does 'FAR' mean here (can I throw them
out)? 
> Do I need to change winsock.h in order to make it parse properly?, and 
> ultimately, how do I make this file parse?
> 
> -Tom
> 
> 

- Raw text -


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