Google Answers Logo
View Question
 
Q: MacOS X programming ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: MacOS X programming
Category: Computers > Programming
Asked by: bokajsen2-ga
List Price: $15.00
Posted: 20 May 2005 00:00 PDT
Expires: 19 Jun 2005 00:00 PDT
Question ID: 523604
I've programmed an rather huge C++ application for Windows and Linux
(x86).  It's a 2D graphics intensive animation program (see
http://www.plasticanimationpaper.dk ). The main application code is
very portable since I've got thin abstraction layers for graphics,
timers, sound, input devices, etc.  I'm using SDL for the graphics and
sound both on Windows and Linux, and hope to use it for MacOS X as
well.

I want to port this application to MacOS X, but I know very little
about this operating system, so I have quite a few questions:

1. I'm used to xterm, tcsh, gvim, gcc, cvs, python.  I take it this
will all work the way I'm used to.  Just nod. :-)

2. I'm thinking of getting an iBook 12" to do the port on.  It has a
G4 processer.  I don't want to support pre-MacOS X, so if I make the
application run on G3, G4, and G5s, will that cover most of the MacOS
X machines out there? Since the application will need a rather fast
machine, I reckon only the latest Mac models will be relevant anyway.

3. A small part of my application contains machine code (for x86
obviously).  Can I rewrite this as G3 code and will it run on G4 and
G5 (and possibly G6)?  Or will I need to rewrite and optimize the code
for each processer?

4. What is the endianess of the G3/G4/G5s?

5. Any other general advice you can point to for porting from Linux -> MacOSX ?
Answer  
Subject: Re: MacOS X programming
Answered By: wildeeo-ga on 20 May 2005 09:27 PDT
Rated:5 out of 5 stars
 
Hi, bokajsen2. Thanks for your question.


1. *nods* :-)

tcsh, vi and the Mac OS' native terminal are installed by default on
10.4, and when selecting the 'BSD subsystem' option in 10.3. Bash is
the default shell in OS X, though (but you can, of course, change
this).

I believe python is installed on every copy of OS X, but I'm not sure.
It might be installed by the BSD subsystem option as mentioned above.
I certainly have it on my machine, anyway.

xterm is installed if you choose to install X11 in the OS X installer program.

gcc and cvs are installed with the developer tools (which come free with the OS).

gvim does not come installed with OS X, but there is a binary
available from http://macvim.org/OSX/#Downloading which seems to work
okay on my machine. I personally prefer (the free) TextWrangler
(http://www.barebones.com/products/textwrangler/) for text editing.

A word of warning - don't expect your users to have all of these. Many
will not, for example, have installed X11 because it isn't selected by
default.


2. Mac OS X requires a G3 processor at a very minimum, and even then
some of the earlier ones are not supported. If you support the G3, G4
and G5, you'll be fine. :-)


3. Yes, assembly code written for G3 should work on a G4, G5 and
probably a G6. There's more information about OS X assembly at
http://developer.apple.com/documentation/DeveloperTools/Reference/Assembler/ASMIntroduction/chapter_1_section_1.html.

If you have the time, it's probably worth optimizing your code for
AltiVec. AltiVec (or Velocity Engine) is an extension to the G4 and G5
chips that accellerates various operations. It isn't available on the
G3, however. More information can be found at
http://developer.apple.com/hardware/ve/.


4. In general, the G3, G4 and G5 are big-endian. The G3 and G4 chips
support a (very, very seldom-used) little-endian emulation mode, but
the G5 does not.


5. A couple of other things I can think of...

- OS X users seem to be less tolerant of badly-written software, or
software with a nasty user interface. (Not that I'm saying yours will
be either. :-)) As an example, the popular cross-platform 3D rendered
Blender, while being very powerful and having a near-identical
interface to that of other platforms, earned various one-star ratings
and comments because of it's non-standard UI (see
http://www.versiontracker.com/dyn/moreinfo/macosx/12740&mode=feedback).

- Use OS X native features where you can - the open and save dialogs
in particular frustrate me if a programmer has decided to re-implement
them.

- Don't use X11 unless you absolutely have to.

- Play with the developer tools. They come free with every copy of OS
X or Mac sold, and many of them are very powerful.

- When you've finished the port, it's probably a good idea to list it
on sites such as Versiontracker (http://www.versiontracker.com/) or
MacUpdate (http://macupdate.com/).

And, as a Mac user, thanks for porting your program to this platform. :-)

If you have any questions, please don't hesitate to request a clarification.

--wildeeo
bokajsen2-ga rated this answer:5 out of 5 stars
Great answers and advice, thanks!  The interface will most likely not
look like MacOS X (or anything else), it's the price we pay for an
easy port.. and we do think a consistent look across platforms is
important.  Also, I hope libSDL doesn't rely on X11 to be installed. 
I'll find out soon enough.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy