Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

McBgnr

macrumors regular
Original poster
Hello,

A number of microsoft products work on Mac and vice versa. Egs. Microsoft Office works on Mac and iTunes works on Windows.

How does one write an application which can work on both Windows and Mac?
Can we write such an application using Xcode? Are there any special things that need to be taken care of while writing such a program?

Inputs are most welcome.

Cheers
McBgnr
 
A number of microsoft products work on Mac and vice versa. Egs. Microsoft Office works on Mac and iTunes works on Windows.

That's a fairly major obersimplification. A Mac version of Office won't work in Windows, nor will Windows iTunes work in OS X. They're essentially two different programs (from a code standpoint) that happen to be the same brand.

How does one write an application which can work on both Windows and Mac?

http://en.wikipedia.org/wiki/Cross-platform#Approaches_to_cross-platform_programming
 
I know an easy way to write a multi-platform program. Write it in Python, in Common Lisp, or an any other language that rarely, if ever, forces you to adapt your program to a platform.

I learned to program on mainframes, where the compilers understood each standard statement in the languages they compiled. Unfortunately, today, compiler writers sometimes omit standard statement from their dialects of some programming languages because they want their dialects to be compatible with other nonstandard dialects of the same language.

I say, "Write a compiler for, say, ISO Standard Pascal, then add the dialect-specific features. Don't replace standard features with dialect-specific ones."
 
The general guideline is to write your application logic in a cross-platform language without using platform-specific APIs and then write your UI in its native form. So for example you could use C++ for the app logic and interface with it via Cocoa and Win32/.NET. There are already frameworks that simplify this for you though, such as Qt.
 
Hello,

A number of microsoft products work on Mac and vice versa. Egs. Microsoft Office works on Mac and iTunes works on Windows.

How does one write an application which can work on both Windows and Mac?
Can we write such an application using Xcode? Are there any special things that need to be taken care of while writing such a program?

Inputs are most welcome.

Cheers
McBgnr

Though not true cross platform, RealBasic is similar to Visual Basic but it compiles executable for different platforms each it's own unique exe.

http://www.realsoftware.com/realbasic/

I've tried it and did a simple web browser and told it to compile a Win32 exe and a OS X *.app. I believe it even does Linux.

I don't use it personally but if your really interested it might be worth checking out.
 
Doing multi-platform is very hard and time consuming, especially if you are single guy doing it all by yourself.

I have a multi-platform product that shares 85 to 90% of its code among MacOS 9, OS X and Windows XP->7 versions. I did Mac OS 9 version in the nineties, then I moved the thing to Windows and later to Mac OS X with Carbon.

Application doesn't look especially good or cutting edge and is not using any APIs on any of the platforms that weren't there 5 or 6 years ago but it does the trick. I need to do something just once, move that code to another platform and recompile. Sometimes it feels like magic, sometimes it feels like cheating, but without it I would have abandoned the whole project long time ago.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.