Thank you, that helps.
And I have found documentation in the FPC 2.2.2 download that talks about the Xcode integration templates that handle initial project setup. I was wondering about that as well.
Ken G. Brown
apparently wrote 28 lines
Date: Mon, 26 Jan 2009 09:20:29 +0200
From: Jonas Maebe
Subject: Re: [fpc-pascal] Calling C functions from FPC
To: FPC-Pascal users discussions
Message-ID:
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
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
