Multi platform software

Discussion in 'Mac Programming' started by McBgnr, May 24, 2010.

  1. McBgnr macrumors regular

    Joined:
    Apr 13, 2009
    #1
    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
     
  2. miles01110 macrumors Core

    miles01110

    Joined:
    Jul 24, 2006
    Location:
    The Ivory Tower (I'm not coming down)
    #2
    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.

    http://en.wikipedia.org/wiki/Cross-platform#Approaches_to_cross-platform_programming
     
  3. Bill McEnaney macrumors 6502

    Joined:
    Apr 29, 2010
    #3
    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."
     
  4. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    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.
     
  5. kkat69 macrumors 68020

    kkat69

    Joined:
    Aug 30, 2007
    Location:
    Atlanta, Ga
    #5
    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.
     
  6. idelovski macrumors regular

    Joined:
    Sep 11, 2008
    #6
    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.
     

Share This Page