On 26 Jan 2009, at 01:24, Ken G. Brown wrote:
On MacOS X 10.5.6 Intel targeting 10.3.9 PPC: What are the gotchas with respect to calling C functions from FPC?
Mark the external C functions you import in your Pascal code as "cdecl", e.g.
procedure cTest; cdecl; external;
What other issues might I have to watch out for?
Make sure that the types in your Pascal and C code match. The easiest is to use the ctypes unit. Then you can use the common C-types by prefixing them with "c" (e.g., cint, clong, clonglong, cuint, culong, culonglong, cfloat, ...). And don't try to free pointers allocated in the C code in Pascal code and vice versa.
Jonas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal