Hello Pascal Developers
i've been wondering about SDL usage for Mac OS X.
OS X sdl, uses Cocoa, that means, application must be created and started using obj-c. For the people, who don't know ObjC, there're a some template projects that can be used together with C/C++ code easily.
There're some fpc-sdl templates for XCode (at jedi-sdl). I'm using Lazarus IDE (codetools mostly wanted feature) for development, and using XCode is pain for me.
It's also possible to use precompiled library, as desctibed at this forum thread: http://forum.lazarus.freepascal.org/index.php/topic,6192.15.html
But it's nicer, if even this gcc usagel can be avoided.
With recent advance in objective-c runtime usage, there's an option not to use ObjC 've converted SDLmain.m (objective-c) to the passdlmain.pas pascal unit (attached to this email), using objcrtl (see PasCocoa bindings)
now, using sdl with OSX becomes easier.
The only thing to do, is add the passdlmain unit to uses section.
uses
...sdl, passdlmain..;That's it. Objective-C application is created on start-up, and passed to the pascal program then ready.
sdl unit (at fpc-package) still links SDLmain and libSDL libraries, that should be removed (otherwise there might be linker errors). passdlmain, links two required frameworks (SDL, Cocoa) and contains compiler switch to rename main pascal function as required.
I hope you'll find this usefull.
Thanks,
Dmitry
P.S.
objcrtl - is the wrapper lib around objective-c runtime (not PasCocoa). It's designed, so objective-c runtime had the same interface independant of objective-c version. Currently it works for 2.0 version (OSX Leopard) with a few wrappers complete, it can work for 1.0 (Tiger and lower) too.
