[fpc-pascal] cocoa programming without objective-pascal mode

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Sun Nov 2 19:38:42 CET 2014


On Sun, Nov 2, 2014 at 3:43 PM, Bee <bee.ography at gmail.com> wrote:
> Is it possible to do Cocoa GUI programming on Mac/OSX using FreePascal but
> without objective-pascal mode/dialect? Just pure object pascal or delphi
> mode. How do I access the Cocoa SDK (foundation, appkit, etc) from pascal
> code?

It is possible, I was doing it before Objective Pascal was created.
Just use the functions in the objective-c runtime, read:

http://wiki.lazarus.freepascal.org/PasCocoa

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ObjCRuntimeRef/index.html

But I warn you that doing this is a terrible choice. Objective Pascal
is the way to go. I've been working in Objective Pascal in the LCL
Cocoa interface and it's pretty good IMHO. But if you are masochistic
you can use the runtime instead of Objective Pascal.

> I don't want to use Lazarus since it only supports Carbon (32-bit only) which will be deprecated in the next few years.

The Cocoa interface is advancing fast. I am even running out of known
bugs, so other people testing would be appreciated.

> It is also breaks one of the most important advantage of FreePascal: cross platform language.

I don't see how Lazarus would break cross platform. That's a wierd statement.

> "I'm an old pascal lover who feels left alone on Apple platform because FreePascal/Lazarus are no longer Apple friendly like they used to be."

You got the order inverted here. It is not FPC/Lazarus that are less
Apple friendly. It is Apple that is each time less Pascal friendly,
and for that matter also each time less C/C++/Java friendly. Apple
wants you to use Swift (or whatever it's called).

-- 
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list