Marco van de Voort wrote:
I don't know how similar the header conversions are between GPC and FPC. (afaik GPC can use C headers directly?)
No yet. But it can easily include little C wrappers that include the headers, and we recommend this.
While converting there were two things I wasn't 100% sure off:
- "const" before a parameter in C. I assumed it only signals that the parameter is not changed in the function,
Yes.
not a reference like Pascal.
It doesn't necessarily mean this in Pascal. That's implementation defined, and depending on the type (yes, even in BP which you're so proud to be compatible to).
In Pascal (I mean standard Pascal, not BP), `protected' means a value parameter which the function does not change, and `protected var' a reference parameter the function does not change. So, one of these should always be used for C interfaces.
- 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 even matter which size the types have on any platform. E.g., C's `long int' is 32 bit on some and 64 bit on other platforms. GPC's `MedInt' is always the same.
Frank