[fpc-devel] MacOSX: EXC_ARITHMETIC in PerformHIConversion

Marc Weustink marc at dommelstein.net
Sun Aug 14 17:40:54 CEST 2005


Hi,

I don't know if it is FCP problem, it looks like it is, but I can't see how.

In XCode i've created a Carbon app with the given in main.c. When 
running this, everything works as expected. However when I replace 
Hello.app/Contents/MacOS/Hello with a version created by FPC from 
hello.pp, I get an exception when I hover with the mouse over the Hello 
- Services - FileMerge menuitem (this is an empty submenu)
Now what I don't get is what this has to do with the fpc generated exe. 
AFAIK this menu is handled by the OS internally.
Am I missing something ? Am I not allowed to change the exe ? Or is it 
something FPC had to compile in the exe but didn't do ?

Anyone any clue ?

TIA, Marc


--- main.c ---
#include <Carbon/Carbon.h>

int main(int argc, char* argv[])
{
     WindowRef   window;
     OSStatus	err;
     Rect        R;

     R.top = 50; R.left = 50; R.right = 500; R.bottom = 200;
     err = CreateNewWindow(
       kDocumentWindowClass,
       kWindowStandardDocumentAttributes |
       kWindowStandardHandlerAttribute |
       kWindowInWindowMenuAttribute,
       &R, &window);

     require_noerr( err, CantCreateWindow );

     // The window was created hidden so show it.
     ShowWindow( window );

     // Call the event loop
     RunApplicationEventLoop();

CantCreateWindow:
	return err;
}

--- hello.pp ---
program FPCCarbon;
{$mode objfpc}
uses
   Carbon;

label
   CantCreateWindow;

var
   R       : Rect;
   err     : OSStatus;
   window  : WindowRef;
begin
     R.Top := 50; R.Left := 50; R.Right := 500; R.Bottom := 200;
     err := CreateNewWindow(
       kDocumentWindowClass,
       kWindowStandardDocumentAttributes or
       kWindowStandardHandlerAttribute or
       kWindowInWindowMenuAttribute,
       R, window);
     if err <> noErr then
         goto CantCreateWindow;

     // The window was created hidden so show it.
     ShowWindow(window);

     // Call the event loop
     RunApplicationEventLoop;

     // Error Handling
CantCreateWindow:
     Halt(err);
end.




More information about the fpc-devel mailing list