Prof. A Olowofoyeku (The African Chief) wrote:
On 17 Dec 2002 at 2:48, Frank Heckenbach wrote:
[...]
Short reality check: GPC already has WordBool etc. (though with 32 bits by default, but you could redefine it as ShortBool, which is in fact better suited than `Boolean (16)' if it's main use it to match `short' in C interfaces).
Is the built in "WordBool" always guaranteed to 32 bits?
Nope, always the same size as `Integer', `Word', `Cardinal' (Pascal) and `[unsigned] int' (C).
AFAIK, there are GNU C interfaces? Which types do they use?
All sorts of typedefs and macros mapping various things to various other GNU things. It is easier for gcc, since they are dealing with interfaces designed for C programmers.
But once it's done in GCC, it can be strgaihtforwardly mapped to GPC (if you figure out the typedefs and macros, that is ;-).
The real problem (??) with the WinAPI is that it is based almost entirely on DLL exports. Therefore the actual parameters supplied must match the ones expected in size, and the sizes of function results must also match - else the DLL will not know what to do with it, and the program will fail in all sorts of ways.
That's true for any external function, nothing specific about DLLs here AFAICS.
I doubt that the interfaces will ever change completely. What might change (and has changed in the past) are the sizes of various types. So today, with 32-bit Windows, INT is 32 bits. With 64-bit Windows, it might well be 64 bits (I don't know, because I am not a beta tester). This should not cause any problem, as long as one can define INT as 64 bits. Then if INT is 64 bits, DWORD or LONG may well become 128 bits, etc., ad nauseum. Of course, GCC will hopefully keep up, and so any manual solutions in GPC should hopefully be minimal.
That would be an ABI decision then (as I supposed), and GCC will usually (always, I guess) follow the ABI of the target platform (where one exists -- not on Linux and the Hurd where GCC is the primary compiler and defines the ABI). This would imply (again, as I supposed) that `WordBool' is more likely to remain correct than `Boolean (32)'.
Frank