[fpc-pascal] How to include Carbon.h?

BlueCat GHF03464 at nifty.ne.jp
Fri Apr 20 07:22:08 CEST 2007



Ingemar Ragnemalm wrote:
> 
> 
> So the Pascal code compiles, links with the RB code, but crashes when it 
> runs? How far does it run?
> [snip]
> 
> 

Thanks you, Jonas and Ingmal.  Here is an example.

Library stub;
{$calling mwpascal}
uses CarbonEventsCore;

function aint(i : smallint) : smallint;
begin
  aint := succ(sqr(i))
end;

exports
  aint name '_aint',
  aint;

end.

I compiled this with FPC 2.1.1 (as suggested by Jonas) and got a .dylib
file.  This can be called REALbasic(Rb) through Soft Declare statement.  The
Rb application runs for some extents.  The function aint is successfuly
called. Rb app displays its result correctly.  If you select Quit from
application menu, it quits.  But if you open a modal dialog (e.g. that to
get a file for opening) from the application and make scrolls, looking
around directories etc. , the application crashes.

Of course, crash does not occure before calling function aint.

I have tryed cdecl and stdcall calling conventions, but the results are
same.

CarbonEventsCore really does something.  Without CarbonEventsCore, the
application won't open a modal dialog but crashes at launching it.

I have considered switching Rb to Lazarus.  But Lazarus currently lacks
components to handle MPEG2 or Quicktime movie files.  That's the main reason
why I use Rb instead.
-- 
View this message in context: http://www.nabble.com/How-to-include-Carbon.h--tf3605888.html#a10091628
Sent from the Free Pascal - General mailing list archive at Nabble.com.




More information about the fpc-pascal mailing list