View Full Version : Mac Development Question - is free pascal viable?

17-07-2007, 09:40 AM
Hi there,

I am think about converting a program to run on the Mac, OSX for PPC and Intel.

My main background is using delphi and the app is in Delphi using DirectX.

Now I have heard about free pascal.

My question is Free Pascal on the Mac a viable option? Or am I going to run into lots hardship with dependencies and libraries not working etc?

Does Free pascal have an IDE like Delphi does - is possible to do RAD development or is it more like turbo pascal?

I figure I could convert the DX stuff to OpenGL.

I know you will say - RTFM but I tried look at the free pascal site and I don't think it is very clear. And I figure someone may be able tell me what I wish to know in a few sentences.

For a mainly Pascal programmer what would other alternatives be for developing on the Mac? C#?

17-07-2007, 10:02 AM
Free Pascal on the Mac can be considered mature, you should have no problems with libraries etc. It integrates in the Xcode IDE, so you can do comfortable development. It also comes with a large amount of API interfaces units.

Lazarus is a different story, while useable, it needs X11 to run. While it can produce Carbon executables, Carbon support is beta quality at the moment. However, you only need to worry about this if you have VCL code.

17-07-2007, 10:11 AM
FreePascal is certainly viable on Mac OS X.. Have a look at these 2 threads where I posted about the stuff I did on Mac OS X using FreePascal...



You other alternatives are Objective C/C++ or possibly Java.

One thing to keep in mind is that the Mono (http://www.mono-project.com) ( the Free version of C# ) team, have started a project called Mono.Xna (http://code.google.com/p/monoxna/) ( uses OpenGL instead of Direct3D ), which would make XNA essentially cross-platform from Xbox 360 to Mac OS X and all the other platforms that Mono runs on. So all you would need to do is code to the XNA api and just recompile for for each platform that you plan to deploy to. This also means that you could use Chrome (http://chromesville.com/) to target all these platforms as well.

17-07-2007, 10:39 AM
Phew! Ok, thanks guys, that was way quick response. Looks like I have some reading to do. I will see how the next few months go with the commercial aspects of my application before deciding to do a mac port. Then I will need to decide if I can do it myself or we find someone else to do it :)



Update: Just read your posts Savage looks really exciting.

17-07-2007, 06:01 PM
It shouldn't be too much of a challenge if what I've been reading about what Dom and the CBC(Cerebral Bicycle Company) boys have been doing with their stuff lately.

Both Crash Block and Guns Reloaded were ported over before. As well as many JEDI-SDL demos.

17-07-2007, 06:17 PM
Yes, if you use JEDI-SDL, it is very easy to get Mac and Linux versions. If are a bit carefull about file name cases etc., it is just recompile and go.

17-07-2007, 06:49 PM
And if you wanted to do 3D, it's my understanding that JEDI-SDL has OpenGL 2.0 headers that work well with FPC. At least they have not let me down any...

17-07-2007, 08:22 PM
Just so I am clear.

RAD is only possible with Lazarus? Otherwise all buttons and other visual components must be created at run time. Is that correct? So Free Pascal is more like Turbo Pascal?

Is it feasible to work on the PC first to prove the concept using SDL and then to take it across to the Mac? I don't really want to buy a Mac only to find I am unable to complete the Mac version myself.

Just to giev a wee bit of back ground my application is not a game it is an motivation application with a screen saver component which I use directx for and other functions that change wall papers, pop up task bar balloons and export images and text to mobile phones etc

17-07-2007, 08:35 PM
Lets put it this way... Delphi is really 2 different products in one.

1) The Delphi Compiler that compiles Object Pascal code.


2) The Delphi IDE that designs the forums and has a whole VCL library that you can use to leverage the visual components of a windowed environment such as Win32.

Lazarus is much the same way. Only instead of having it's own built-in compiler it uses Free Pascal instead. So everything Lazarus or LCL is the visual stuff. And Free Pascal is the core of all of that.

I'd liken FPC more to what GCC is than Turbo Pascal though... Thats kind of the same as trying to compare GCC to Turbo C. :P

But for the short answer; to do RAD you need the visual IDE so that means Lazarus.

Also note that there is no DirectX for the Mac so it would probably be best to stick with a more cross-platform API like OpenGL or SDL depending on what you're needs are.

You should also know that the more deep you delve into OS specific features, ie. screensavers, control panels, settings, etc... the more OS specific code you will need. So that means more IFDEFs throughout your code. It's not necessarily bad or improper, but most experienced developers stay away from OS-specific because it creates a lot more work for you.

Imagine having 3 sets of code each for a different OS. Now you have to test each one separately. So try to do as little of this as possible at all times. Even when it's necessary.

17-07-2007, 09:01 PM
Note that Lazarus works on Mac, so if you want to do RAD development, feel free to do so, you can recompile your Lazarus apps for Mac with the push of a button. However, I'm just trying to prevent false expectations; Lazarus for Mac is still being worked on.

However, while doing game development, you aren't using Delphi's RAD facilities either. I'd say game development is both feasible and compfortable under Mac.

06-08-2007, 07:09 PM

I confirm it's perfectly possible to make very stable ports of Delphi/Pascal apps to MacOSX using FreePascal. Provided you stick to pure cross-platform libraries (SDL, no Win32 specific code) you should be able to compile your apps in a snap.

Beware of Endianness on PPC though ! :wink:

07-08-2007, 12:44 AM
Momor! Long time. :) Hows things? Any chance to see any past Momor Productions game being ported to the Mac?

07-08-2007, 07:09 AM
Hey Will,

Unfortunately past Momor Prods games were using Win32-only components, I would have to rewrite most of them for that. :?

28-10-2007, 11:09 AM
Meanwhile, Lazarus for the Mac (Carbon, without X) is starting to get feature complete and is expected to be usable by the end of the year.

I played a bit with the GUI, porting some (very, very simplistic) game and I was told it has the same problem as GTK2, you can only draw in an onpaint event of the component you are drawing.

If you are creating Delphi games, try to remember this. Never draw outside onpaint events if you want to be portable.

28-10-2007, 05:47 PM
What is an 'onpaint event'?

03-11-2007, 03:30 PM
What is an 'onpaint event'?

TForm.OnPaint is called if a component must draw itself in Delphi or Lazarus.

03-11-2007, 04:31 PM
Oh ok I see. This only effects the GDI environment portability, right?

22-11-2007, 12:18 AM
Hi Savage, your pages of SDL/MAC/PASCAL looks really good.

I think I will take the plunge and buy a macbook or imac. I would prefer a MacBook Pro but can't justify the cost, so I am think to go with the macbook. I am not 100% sure if the macbook is the way to go - if anyone has any practical experience I would love to hear it.

My idea is to hang a macbook on a standard PC 22inch LCD - so the small macbook screen wouldn't be a hassle.

From everything I have read I will use the inbuilt Xcode, SDL and possible GNU PAscal or Free Pascal. Does anyone have any good reasons to go with the one or the other?

One last question if the macbook is an intel CPU will the resulting program still work on a powerPC or would that version need to be built separately?

22-11-2007, 02:52 AM
From everything I have read I will use the inbuilt Xcode, SDL and possible GNU PAscal or Free Pascal. Does anyone have any good reasons to go with the one or the other?

Are you asking which would be the better bet between GNU Pascal and FPC? Thats a super EASY answer; FPC all the way! GNU isn't even a compiler technically. It piggybacks off of the GNU C compiler so it's like using a front-end for a compiler of a completely different language architecture. :P

Also, FPC is really active these days where as GNU Pascal has wound down to a halt? (can someone verify/deny this?) And if I'm not mistaken it's been something like years since a release.

Oh and final nail in the coffin, GNU Pascal's support is hard to locate find where as support for FPC is abundant. ;)

22-11-2007, 03:41 AM
ok, FPC it is.

Ok in that case is it better to go

XCode with FPC


Lazarus with FPC?

22-11-2007, 08:56 AM
If you need RAD, use Lazarus, otherwise use the IDE you like better.

22-11-2007, 01:35 PM
If you are using SDL, I've literally gone through the pain of getting Lazarus, SDL and porting a Delphi Forms project over to Mac OS X so can offer advice. Overall it's a fairly painless process, more so now I know a bit more of how Lazarus works on the Mac.

So if you have any questions, fire away.

22-11-2007, 04:43 PM
I guess you could also add that Lazarus is it's own stand-alone package, where as --at least as far as it sounds to me-- with this XCode, etc... you'd have to do some extra configuration to get it going, where as Lazarus is 'out of the box'.

That and the more people that use Lazarus on a Mac the better they can make it for the Mac. ;)