in reply to Re: Perl / Win32 / VC++ / USE_LARGE_FILES
in thread Perl / Win32 / VC++ / USE_LARGE_FILES
That is exactly why I brought this up here rather than on p5p.
From the p5p perspective, Borland doesn't support huge files - so don't use that. Trouble is, the seperation of the build-time options isn't good enough, and even trying to build with PERLIO and not LARGE_FILES, breaks, because one or more of the three calls you mention is used by PERLIO!
From Borland's perspective, the compiler is free and doesn't support huge files. If you want that then buy their professional compiler suite.
That's the correct view from their (p5p and Borland) point of view, but I still want to build perl with Borland. I don't have, and have no wish to purchase VC++! Given that the resultant code is going to run on the same target, the OS obviously has the capability and given that PERLIO already isolates all the CRT IO components into win32_* wrappers, it becomes a fairly trivial matter to bypass the CRT for those three calls and go direct to the OS. This is what I have done, and it's working great!
The point of this post is that in addition to the various varients of tell(), seek() and stat() that must be transmuted to their 64-bit equivalents. The perl sources also use fgetpos() and fsetpos(). They use the definition of fpos_t which by default is 32-bit. It was when I went looking to see how these calls handle the transition to using a __i64 when using VC++ (so as to get a clue as to the best way for me to handle the same under Borland) that I came up empty.
The VC++ documentation (and now confirmed by halley above. Thanks!) indicates that the selection of which definition of fpos_t is used is determine by the target platform. If your building for a 64-bit platform, then the natural integer size is 64-bits and so that gets used. The problem is, the majority of Win32 platforms are 32-bit, but they still support huge files. The question that arose was how do you pursuade the VC++ compiler to select 64-bit semantics for fgetpos and fsetpos whilst building for a target where the natural integer size is still 32-bit.
This question is still unanswered! If I am right, then it is at possible that when building perl using VC++ using USE_LARGE_FILES and/or USE_PERLIO, that these two calls are still using the 32-bit definition of fpos_t. If that is the case, given the number of uses of fgetpos/fsetpos that appear in the sources, including it's use in the implementation of one or more of the _*i64() routines you mentioned above, then it would appear that there is a hole in perl's support for huge files even when using VC++. I have patched these two calls also for use with Borland, and I now have a fully specified, working version of perl built with Borland that correctly handles tell(), seek(), stat() (and -s) on files up to at least 10 GB, so I am a happy bunny.
However, if this was a bug with VC++, then that would be a fairly major bug and would be very much a matter for the attention of p5p. It is to this end that I have posted this here in the hope of verifying my suspicions with the help of other monks who have VC++ (& experience) before sending the very busy p5p guys on a wild goose chase.
That said, I have used AS 802 (built with VC++) to test this and it also handles my 10 GB file correctly. The only question I am now trying to clarify is how does it do this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Perl / Win32 / VC++ / USE_LARGE_FILES
by Courage (Parson) on Aug 27, 2003 at 01:19 UTC | |
by BrowserUk (Patriarch) on Aug 27, 2003 at 01:59 UTC |