what is programming on Mac like?

Started by
15 comments, last by n0ob 20 years, 7 months ago
I was just wondering how programming for macs works. Do they use C++? Do they have versions of DirectX or OpenGL? There must be a whole different standard library right? They obviously don''t use any win32 functions right? Anyway, I was just wondering. Thanks! Kings of Chaos
Advertisement
Yes, they can use C++, and they have a version of OpenGL. They don''t have direct X, as that''s a windows only thing. The standard library is just that... standard, no matter which OS/platform, the library does the same thing. Programming OpenGL is practically identical, as is the entire C++ standard, and using the standard template library (stl). Their are differences in how you get input, create a window, etc (all the win32 specific crap can''t be done on a mac for obvious reasons), but things like SDL, GLUT, etc make cross-platform VERY easy. Then you have your audio libraries, like fmod, which is also cross-platform. If you use GLUT (I think it''s available for mac anyways?) and fmod, you could easily write a program that would compile for a PC (linux and windows) and mac.

Macs initially used Pascal, but soon thereafter (mid 80s) C and, later, C++ became popular. The standard libraries are available as usual, although the Mac file system looks even less like UNIX than the Windows file system, so using standard file I/O may cause Acute Clunkiness Syndrome.

Macs support OpenGL, with special APPLE extensions (instead of, say, NV or ATI extensions). They try to make them similar across the NVIDIA and ATI chips that they put in the machines, but I don''t know how well they succeed.

For GUI/native access, MacOS 9 uses something called "the toolbox" which serves the same purpose as Win32, but with diffences in data structures and function names.

MacOS X is another beast. It has a version of the toolbox called Carbon, but it also has lots of NeXT stuff, including a Berkeley flavor UNIX.
About the standard library.. How can it run on any platform? The processors use different codes or whatever right? Does this mean that the compiler puts the binary stuff together the right way for that platform? What kind of data is stored in the standard libraries that can be interpreted on any platform. What is the topic of this that I can research? Thanks!

Kings of Chaos
quote:Original post by n0ob
About the standard library.. How can it run on any platform? The processors use different codes or whatever right? Does this mean that the compiler puts the binary stuff together the right way for that platform? What kind of data is stored in the standard libraries that can be interpreted on any platform. What is the topic of this that I can research? Thanks!

Kings of Chaos


No, it means the writer of the compiler is responsible for filling in all functions under the platform that it will be compiling for. That means, that while some functions are part of the C++ standard, gcc, msvc, codewarrior, etc all implement it differently, but it still gets the same job done. This means, you must compile the program under each OS, for each OS that you plan on using it with, as the output files aren''t compatible. The C++ standard defines a bunch of things that MUST be implemented, and what the implementation must do... how the person goes on about implementing it is up to them, and is dependant on the platform.
alright, so each compiler comes with a different set of the actual code, right? What compilers are used on Mac?

Kings of Chaos
quote:Original post by n0ob
What compilers are used on Mac?


Under Mac OS X:
Project Builder (free from Apple), soon to be called X-Code in Panther (Mac OS X.3). Though I suppose I should say GCC as that''s what Project Builder uses as its compiler.
Codewarrior

Under Mac OS 9:
Codewarrior
MPW (free from Apple)

quote:Original post by n0ob
About the standard library.. How can it run on any platform? The processors use different codes or whatever right?


The standard is just an interface. It just says what needs to be done, not how it needs to be done. A system can meet those needs anyway it wants to, just as long as it meets them.

Take memory allocation like new or malloc(). Getting dynamic memory is very system dependent, so malloc() will be implemented very differently on MacOSX than it is on Windows. But both versions give memory out when called upon, and that''s all the programmer cares about.
quote:Yes, they can use C++, and they have a version of OpenGL. They don''t have direct X, as that''s a windows only thing


They have directx for mac

click
Wow.. I looked at that MacDX page. Only difference is that they CHARGE you for it. DirectX still remains free.

Mac sucks again!

[edited by - Coaster Kev on August 31, 2003 10:35:46 PM]

This topic is closed to new replies.

Advertisement