Re:OS X app in plain C
by thought_alarm on Thursday May 05, 2016 @03:51PM
(#11639183)
Look at the makefile again. It builds five different binaries from the same source file, one of which using a C compiler.
This is no different than writing a COM application in C. Both COM and objc runtimes provide similar dynamic OO services over a plain C API.
Re:OS X app in plain C
by convivialdingo on Thursday May 05, 2016 @06:50PM
(#11640283)
I just ran the code through clang (Apple LLVM version 5.1) with no problems. You don't have to rename the source - but perhaps there are issues in other configurations.
clang -framework Foundation -framework OpenGL -framework Cocoa -o test test.c
Re:OS X app in plain C
by hunterwerlla on Thursday May 05, 2016 @03:40PM
(#11639114)
So obviously it's impossible to write a linux app in anything pure but C because the kernel is written in C. That makes no sense.
To be fair, I think that's a perfectly reasonable goal in and of itself - showing how to set up an OS X app "from scratch" is definitely something I'm interested in - but we shouldn't pretend this isn't strongly relying on Objective-C to actually get things done.
EDIT: indeed, the makefile copies main.c to main.m before invoking clang, which means it's using the Objective-C compiler.
What would be much more impressive is if this used only the C Core* frameworks (Core Foundation and Core Graphics in particular) to do the same thing.