[fpc-pascal] Problem with Objective Pascal and delphi mode

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Thu Jan 28 15:26:59 CET 2010


Hello,

I am having trouble with the delphi mode and objective pascal. If I
use this defines:

{$mode delphi}{$modeswitch objectivec1}

Then I get an error in this line:

  MainWindow.contentView.addSubview(TextField);

simpleform.lpr(63,26) Error: Unknown record field identifier "ADDSUBVIEW"

And in this one too:

  NSApp.run;

simpleform.lpr(71,9) Error: Unknown record field identifier "RUN"

If I use

{$mode objfpc}{$modeswitch objectivec1}

then everything builds fine.

Also, some more things:

Is creating the autorelease pool necessary or will the compiler do it
automatically? I see that it isn't created in some examples which use
NSApplicationMain, and in the docs of this routine It's never said
that it will create the autorelease pool.

Also, should I initialize NSApp or just use the default? I remember
that one needed to initialize it in PasCocoa with:

  NSApp := NSApplication.sharedApplication;

thanks,
-- 
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list