views:

127

answers:

3

Hello,

I'm learning Objective-C and my friend have a real Macintosh IIci, that uses a Mac System 7(specifically 7.5.5 with a 68k processor) and I've installed Metrowerks C/C++ IDE(I think it's the version 1, but I don't know), but i didn't tested it, then i want to know one thing: It's possible to develop in Objective-C using NSObjects/Objects and AppKit or something like this on it? Thanks.

A: 

No, it's not possible they are just too old to my knowledge.

gcamp
+5  A: 

Short answer: no.

Objective-C became the lingua franca of mac development with OS X, which went into beta 10 years or so after that computer shipped. Most development for pre- OS X systems was done with C or C++.

Without OS X, you won't have any of the system libraries or headers to link against, and the Metrowerks compiler won't know anything about the Objective-C syntax or runtime extensions to C.

To top it off, the Objective-C frameworks are built for PowerPC (or now, Intel) macs, whereas the processor in that machine uses the older 68k architecture.

Stephen Canon
7.5 still had a great deal of Pascal in it.
Azeem.Butt
@NSD: Very true.
Stephen Canon
Actually, late versions of CodeWarrior _did_ support Objective-C, despite having no runtime library to link to, but neither version 1 did. :-)
Ahruman
+4  A: 

The short answer, as Stephen says, is no. But, just for fun, I started thinking about what you'd have to do to actually make that work.

1) You'd have to make gcc run on the 68k (gcc is the compiler that speaks Objective-C; you could probably substitute llvm for gcc, but let's not get too crazy). This is no mean feat. A quick look at the latest gcc builds does not show anything for that platform (unsurprisingly). I'm not an expert on gcc, but I bet it uses gcc-specific extensions and modern C so getting it to compile with an existing 68k compiler will probably be a non-starter.

So the first step for this will be adding an 68k back-end to gcc. This will allow gcc to spit out code that will run on a 68k. You could then use an x86 build of gcc with 68k support to cross-compile a new gcc binary that will actually run on your ancient Mac.

Having never messed with gcc before, I suspect that this task would take me about two-three years. Maybe more. but still, it's not impossible.

2) Once you've got a modern version of gcc that you can run on your 68k machine, you can use it to cross-compile for x86 or PPC. (Since you're talking about AppKit, you will never be able to actually RUN any of these programs on your old computer. All testing will have to take place on a more modern machine.) You now have to get all of the libraries and headers for Cocoa/Foundation/AppKit/libc/etc from your target machine (a PPC or x86 Mac) and put them somewhere that the gcc on your 68k can find. This will probably take a good 6 months of finagling to get right. But again, it shouldn't be impossible.

It might not be legal, though. As far as I know, the license agreements for OS X (which contains Cocoa) and Xcode will not let you move those binaries around willy-nilly to any machine you want. You would want to speak to a competent attorney before doing this as no one wants to get a visit from Interpol.

3) I think you're done at this point. You can write Objective-C/Cocoa code on your Mac IIci, compile it for a PPC or x86 Mac, ship it off to an OS X box using your favorite method (I've only been a Mac guy since 2005 so I don't even know the connectivity options on the IIci), and test and debug it rather painfully.

At this point, you have access to a Mac running OS X on either a PPC or x86 chip. And you will wonder why you don't just do all your development on THIS machine instead. And since you've spent a few years getting your IIci development environment set up, buying an old PPC Mac for development will be cheap.

Still, it could be a fun idea. It'd probably get you on the reddit front page if you pulled it over. (Though, honestly, it'd be easier to just fake it for YouTube if that's all you're after.)

James Williams