[ale] Ms -> Linux porting pointer sought
John Mills
johnmills at speakeasy.net
Thu May 15 13:07:22 EDT 2003
Joe -
Thanks for the details here.
On 15 May 2003, Joseph Knapka wrote:
> > That's what I'm doing. Numeric types have not been a problem to define,
> > but I'm looking for *nix synonyms for generic 'HANDLE' (U16, I guess?)
> > and 'SOCKET'. I don't have much in the way of MsWin examples to look at,
> > compared to all the *nix sources. I admit to being 'Windows challenged'.
> IIRC a HANDLE is essentially a void*. But HANDLEs are used for
> resource acquisition all over the place in Windows: you have HANDLEs
> to files, windows, paintbrushes, shared memory areas, etc etc etc etc
> etc... In all those different cases, the data structure pointed to by
> the HANDLE is different, and only the Win32 implementation knows what
> to do with them (this is fine API design, BTW; Microsoft does actually
> do some things right. Well, one thing, anyway). Anything that uses a
> Windows HANDLE is generally going to require rewriting for Linux.
Looks like I'm going to meet some of those.
> In Linux a socket is represented by an int. In Windows, it's another
> kind of HANDLE, I think, but code that uses sockets on either OS
> shouldn't care about the representation of sockets. Therefore, if you
> use a "typedef int SOCKET" on the Linux side, most Winsock code should
> compile verbatim, except the bits that initialize the Winsock library
> (which is redundant on Linux anyway).
As long as there is a usable Linux type that's functionally similar to a
MsWin type, my "synonym" approach is transparent. When the two worlds need
different processing, we will have to provide parallel code. I _don't_
want to replicate the MsWin API in Linux (sort of a reverse-cygwin), just
to keep code maintenance as sane as possible between the two domains.
Thanks again.
John Mills
john.m.mills at alum.mit.edu
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list