32 bit file handles
Tony van der Hoff
tony at mk-net.demon.co.uk
Sun Nov 11 10:49:45 GMT 2001
Bummer!
The nice scheme to use macros to make non-w functions synonyms of the w
functions, which we thrashed out in -user won't work as it stands.
Recall that we were going to add to, say, SWI.OSFind, the line "NEEDS
OSFind32". Also, in OSFind32, we were going to do:
#define osfind_openin osfind_openinw
Now, in h.osfind we have:
extern os_error *xosfind_openin (osfind_flags flags,
char const *file_name,
char const *path,
os_f *file);
extern os_f osfind_openin (osfind_flags flags,
char const *file_name,
char const *path);
So, if that #define is included *before* these prototypes, as it would be by
DefMod, after name substitution we'd end up with two identical prototypes,
which I think would be faulted by the compiler. Ugh!
It is evident that the name substitution needs to be applied to the user's
code only, not the OSLib prototypes.
One way to achieve this would be to require the user to #include OSFind32.h,
instead of OSFind.h, as per Jonathan's original suggestion. OSFind32.h could
then #include OSFind.h, and only after this perform the renaming. I don't
really consider this acceptable, as it adds a burden on the user.
I don't think there is any clever trickery one can play with the preprocessor
to achieve the correct result.
An viable alternative may be to create another DefMod directive, say
NEEDSATEND, which would place the #include at the end of the file. I don't
think this would be too difficult; probably not much more than duplicating
the NEEDS code, and passing another table to the back-ends.
I have considered a number of other possibilities (for instance, if we're
changing DefMod, why not get it to include the switch in the headers), but
rapidly came to the conclusion that this would be extremely difficult and
messy. It also doesn't seem appropriate to change the language to get round
an implementation error.
So, has anyone got any better ideas? If not, I'll try to implement
NEEDSATEND.
Cheers, Tony
--
Tony van der Hoff | MailTo:tony at mk-net.demon.co.uk
| MailTo:avanderhoff at iee.org
Buckinghamshire, England | http:www.mk-net.demon.co.uk
More information about the oslib-team
mailing list