[fpc-pascal] How to include Carbon.h?
jonas.maebe at elis.ugent.be
Thu Apr 19 11:23:31 CEST 2007
On 19 apr 2007, at 11:01, BlueCat wrote:
> I'm using FPC 2.0.4 on MacOSX 1.4.9 PPC and trying to write a
> Pascal library
> that is externally called from REALbasic (Rb). But Rb needs
> Carbon.h header
> included in dylibs which are called by Rb programs.
> In C, it's easy:
> #include "Carbon/Carbon.h"
Including that header that does not add any code to your dynamic
library, so the actual requirement has to be something else. I know
someone who is using an FPC-compiled dynamic library in a (universal)
REALBasic program, so it is definitely possible.
> Unfortunately, I am not familier to C, so that, I want to write the
> in FPC. How it can be achieved in FPC?
The closest equivalent is the FPCMacOSAll unit. But this will not add
any code to your program if you don't call any of its routines,
similarly to including Carbon/Carbon.h
> Could you give me some suggestions?
> I have used CarbonEventsCore.ppu, but found not sufficient enough.
> application still crashes in certain circumstances.
The crashes are probably due to a bug in the 2.0.4 compiler, not due
to not including Carbon/Carbon.h or so. Try installing a snapshot:
Further, make sure that all routines which you call from the
REALBasic program have the calling convention "mwpascal". You can
switch this calling convention on in all Pascal sources by adding
this at the top:
More information about the fpc-pascal