keronresource.blogg.se

Using swift to compile c on macos
Using swift to compile c on macos










using swift to compile c on macos
  1. USING SWIFT TO COMPILE C ON MACOS HOW TO
  2. USING SWIFT TO COMPILE C ON MACOS FOR MAC
  3. USING SWIFT TO COMPILE C ON MACOS MAC OS
  4. USING SWIFT TO COMPILE C ON MACOS CODE
  5. USING SWIFT TO COMPILE C ON MACOS MAC

Note that while I’ve put a built Swift.o in this toolchain, you’ll probably only have success with optimized code that doesn’t actually have any remaining links to the stdlib (i.e. If you want a prebuilt PPC-capable Swift toolchain, here’s one: ppc-swift-toolchain. You will also need the mpw emulator and a copy of the Macintosh Programmer’s Workshop tools 9 to build an actual app using modern macOS. Note the directory and branch names of the sub-repos, and note that they should be nested inside the ppc-swift-project repo. Make # quick start to build swiftc and the stripped-down stdlib If you want to build your own PPC-capable Swift compiler, check out the following repositories: git clone

USING SWIFT TO COMPILE C ON MACOS HOW TO

I assume a good number of people reading this would like to know how to do it too! (Check out that blazing fast 400MHz processor!)

USING SWIFT TO COMPILE C ON MACOS MAC

So, without further ado, here’s a picture of a Swift Toolbox app running on Mac OS 9.2, on my friend Nadine’s Power Mac G4. Is this useful? No! Absolutely not! But neither was ROSE-8, and yet I still learned a lot doing it.Īs you probably guessed, I managed to accomplish this, or I wouldn’t be writing this blog post.

USING SWIFT TO COMPILE C ON MACOS FOR MAC

I package it up as necessary for Mac OS 9.I compile it for PowerPC with (a version of) the Swift compiler.I write Swift source code that calls Carbon / Toolbox APIs.Since I learned to program on Classic Mac OS, and years later spent a good chunk of my career working on Swift, I’ve had the tantalizing thought that I’d like to write a program in Swift and run it on Mac OS 9. Apple never released a 64-bit version of Carbon, presumably to encourage developers to move to Cocoa, and with last year’s macOS Catalina, support for 32-bit apps was dropped entirely with very few exceptions. (h/t Marshall Elfstrand for the video link.)Ĭlassic ended with the switch to Intel processors back in the 2000s, but Carbon worked all the way up to last year, macOS Mojave. ( Sound familiar? 7) Fun aside: This is the reason (one of the reasons?) Core Foundation exists-to provide a common interface between Carbon and Cocoa. You basically just recompiled your app and added an extra annotation saying you were “Carbonized”.

USING SWIFT TO COMPILE C ON MACOS MAC OS

6Ĭarbon was a packaged-up version of the old Mac OS Toolbox APIs so that you could write Mac OS X apps the same way you always had. Think of it like Wine / CrossOver rather than VirtualBox / Parallels. But its life ended with the switch to Intel-powered Macs-Classic was built on running the instructions in the original apps directly, only having to provide compatibility shims for libraries. It really was quite effective, and actually survived longer than booting into Mac OS 9 (which never received support for newer PowerPC processors).

using swift to compile c on macos using swift to compile c on macos

Because the Classic environment was itself an app, all the programs that ran inside it were protected from interfering with other Mac OS X programs and vice versa. The Classic environment set up a sandbox that looked enough like Mac OS 9 to run Classic Mac OS programs directly in Mac OS X.

using swift to compile c on macos

But Apple didn’t want to just leave OS 9 programs behind, so they did two things: Mac OS X was a huge step forward from Mac OS 9 in a number of ways, including preemptive multitasking so that you could actually run multiple things at once. Its successor Mac OS X 5 also ran on PowerPC when it first launched it wasn’t until 10.4 that Apple began to switch to Intel processors instead, and 10.6 when PowerPC was finally dropped. Mac OS 9 ran on PowerPC processors, which were also used in the GameCube, PS3, and Xbox 360 earlier versions of the OS had started on Motorola’s 68k CPU series. 4 If a program crashed or overwrote memory it wasn’t supposed to, there was a good chance you’d have to restart the whole system. It also dates from the days when only one program could run at a time because of that, even the latest version uses cooperative multitasking to run multiple programs-that is, a program has to yield its time to let others run. 3 It was one of the first OSs to use a GUI at all, something that we pretty much take for granted these days. Twenty (!) years ago, before the macOS 2 we know today, there was another operating system known as “Mac OS”. This year I decided to seriously attempt something that I’d thought about in the past: getting a Swift program to run on Mac OS 9. Last year I implemented the world’s best code visualizer. And while pranks on April Fools’ seem less and less fun 1, obvious jokes and whimsy, not at anyone’s expense, are still something I believe in…and even better if they actually work. While this year is a sober one due to current events, I think a lot of people still appreciate what people are creating and sharing to keep spirits up, whether that be music or art or…impractical programming projects. It’s April 1, and that means it’s both April Fools’ Day and the anniversary of the founding of Apple Inc.












Using swift to compile c on macos