On 06 Jan 2008, at 19:03, Felipe Monteiro de Carvalho wrote:
I translated enougth headers to call NSApplicationLoad and
NSRunAlertPanel, but I got stuck at the @"string" syntax. I tryed to
just define PNSString as a generic pointer and pass a PChar to it, but
it doesn't work, the application crashes with messages that the
autorelease pool isn't installed:
@"string" is indeed a shorthand for a constant NSString. Compiler
magic is required to construct these properly (similar to how you
can't just fake a constant ansistring by using a pchar on a compiler
which doesn't support ansistrings). E.g. @"This is the title" is
translated into this:
.cstring
LC3:
.ascii "This is the title\0"
.section __DATA, __cfstring
.align 2
LC4:
.long ___CFConstantStringClassReference
.long 1992
.long LC3
.long 17
.text
Without this supportyou must create the NSString at run time from a
regular constant string. Regarding when you need an autorelease pool
and when not (and how to create it), see e.g. http://www.otierney.net/objective-c.html#autorelease
Jonas
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel