Milan, Jonas, Thanks a lot.
Jonas Maebe-2 wrote 7 lines
[snip]
This is incorrect. That version is very outdated and contains several
errors. As of 2.0.4, FPC contains the common Mac OS interfaces for
FPC, GPC and MW, which contain many more Pascal headers than what
Apple distributes and also many bug fixes.
Maybe because I am new on Nabble, I did not notice Milan's post before my second post. Milan, Your suggestiion was very helpful for me so that I can realise how to link Carbon framework in FPC with a command line option -k. Now, I can use FPCMacOSAll unit, which may Jonas mean, without get the linker angry. My humble stub comes to be;
Library stub;
{$calling mwpascal}
uses FPCMacOSAll;
function aint(i : smallint) : smallint;
begin
aint := succ(sqr(i))
end;
exports
aint name '_aint',
aint;
end.
compiled with options
fpc -Mmacpas -k"-framework Carbon" smallstub
The dylib now works rather well, but still is somewhat unstable. The system modal dialog still hangs after heavy usage. I am now wondering this is due to any initialisation problem.
I have an additional question to Milan. Google tells me that there is AggPas program by Milan, maybe you :-) Does this application use QuickTime API? If QT or MPEG2 file can be easily accessed by FPC, porting my application to Lazarus become quite a favourable choice (but it must be discussed in another thread).