[Zlib-devel] zlib 1.2.4 released!
William A. Rowe Jr.
wrowe at rowe-clan.net
Thu Mar 18 19:17:09 EDT 2010
On 3/18/2010 11:59 AM, Vincent Torri wrote:
>
>
> On Thu, 18 Mar 2010, John Bowler wrote:
>
>> From: zlib-devel-bounces at madler.net
>> [mailto:zlib-devel-bounces at madler.net] On Behalf Of William A. Rowe Jr.
>>> It might look something like;
>>>
>>> ZEXTERN gzFile ZEXPORT gzwhopen OF((HANDLE file, const char *mode));
>>>
>>> #define gzdopen(fd, mode) gzwhopen((HANDLE)_get_osfhandle(fd), mode)
>>
>> Yes, that works, presumably surrounded by '#ifdef WIN32'. Are there
>> any other OSes where the POSIX layer is not native, so may suffer from
>> the same issues?
>
> Windows CE is even different :-) I think that Pedro Alves can comment on
> it. (iirc, a fd is a HANDLE, so :
>
> #define gzdopen(fd, mode) gzwhopen((HANDLE)fd, mode)
Ack. However, unless 'fd' was returned from the posix-form 'open()' call, this
wouldn't be a good mapping. It's better to leave it undefined, as on BEOS and
RISCOS, and simply let them use gzwhopen (a windows-specific, non-posix feature).
So the CE pattern devolves to CreateFileI() -> gzwhopen() -> gzfuncs().
Just to clarify; the lib does not close a gzdopen()'ed file? Or does it?
If so some DuplicateHandle/crt close() magic might also be required on that #define
stub.
More information about the Zlib-devel
mailing list