Marco van de Voort wrote:
Marco van de Voort wrote:
not a reference like Pascal.
It doesn't necessarily mean this in Pascal. That's implementation defined,
[snip]
Yes I know, but language interfaces are implementation specific. Of both languages.
Not too much (or they shouldn't be). E.g., in C `const' has a well-defined meaning (like `protected' has in Pascal). The type sizes are usually defined by the ABI, so I don't think it's implementation specific ont he C side (otherwise, e.g., system headers couldn't be shared between different C compilers as they are on some Unix systems where GCC is not the default compiler).
On the Pascal side, it unfortunately is since Pascal was not designed for such things (I don't blame Borland this time, though they didn't actually do much to improve the situation).
`const' parameters are especially bad because AFAIK it's not very well defined in which situations they are passed by value and by reference. I think in some cases (small records?) it depends on the size of the type, i.e., it might end up being passed by value on one platform and by reference on others. (Of course, this wasn't a problem for Borland who invented this "feature" because they only supported one platform at that time.) That's why I think it's a mistake to ever use `const' parameters in an interface to C (or any other language).
- One function returns a (64-bit) structure. I hope that doesn't create problems. Never interfaces to C with such function.
No problems in GPC. Just use the appropritate type (see Programming/Data Types/Integer Types/Main Branch Integer Types in the GPC manual).
It doesn't seem to be a problem in FPC either, at least not in standard mode. Maybe an artifact in my memory, or because it is 64-bit. (2* natural size)
On some processors it is, on others it's a single word. No need to worry about in a high level language. ;-)
Frank