Waldek Hebisch wrote:
Peter N Lewis wroteL
You might want to consider writing wrapper routines (that accept string values and pass references).
Ignoring Adriaan's misplaced sarcasm, it is not practical to write wrappers for interface functions like this. Interface functions are by definition interfaces on to existing routines, and have no code associated with them (even the initialization code required by GPC causes us problems). Not upgrading GPC would be a preferable solution to writing wrappers around all these routines with all the code changes and implementation code issues that would require.
Could you elaborate what problems wrappers cause? I can see that generating wrappers takes some effort and they cause some space and time overhead at runtime. So I would avoid needless wrappers. But I would say: if you need them, them use them.
Despite the claims in GPC to the contrary, "const" array parameters must be passed by reference according to the ABI anyway, and there is no way for the compiler to optimize it out since in these cases it can never have any access to the code behind the declaration since it is in the system.
I would be not so religious about ABI. Apple ABI seem to expose many low-level details without real need. My impression is that this is already causing them serious compatibilty problems. Wrappers allow to isolate Pascal programs at least from some low level details.
I agree completely to both points.
Both things can help make using the interfaces (i.e., Pascal programming) more comfortable, and unless the call overhead is of superior importance, I'd prefer the comfort. (I can imagine that there are a few cases where efficiency matters. In these cases, you'd still need hand-written conversions in place, but for the same reason, you usually want to avoid anything implicit and write everything explicit to have full control. In a few places, this might be acceptable ...)
Frank