I found this repo while looking for an equivalent to Win32 hello world[0] as a learning exercise during a long flight (with my work MacBook instead of my personal Windows machines). That's something I really like about Windows APIs — I can pick a new programming language I want to play with, as long as there is a way to interface with C I can try to port the Win32 hello world then play around. 0: https://learn.micros…
The WIN32 API is somewhat ugly. I hate how all types are capitalized and their short abbreviations in arguments are sometimes weird. I hate how they have their own version of lots of standard C types that you have to be careful about (they weren't standard at the time, to be fair). But it's quite straightforward and easy to use. Any language that has FFI can call into it and build GUI apps, I've made a windowed Hello…
C-Macs – a pure C macOS application
61–70 of 138 posts
Re: C-Macs – a pure C macOS application
#62Re: C-Macs – a pure C macOS application
#63Re: C-Macs – a pure C macOS application
#64Re: C-Macs – a pure C macOS application
#65I found this repo while looking for an equivalent to Win32 hello world[0] as a learning exercise during a long flight (with my work MacBook instead of my personal Windows machines). That's something I really like about Windows APIs — I can pick a new programming language I want to play with, as long as there is a way to interface with C I can try to port the Win32 hello world then play around. 0: https://learn.micros…
The WIN32 API is somewhat ugly. I hate how all types are capitalized and their short abbreviations in arguments are sometimes weird. I hate how they have their own version of lots of standard C types that you have to be careful about (they weren't standard at the time, to be fair). But it's quite straightforward and easy to use. Any language that has FFI can call into it and build GUI apps, I've made a windowed Hello…
I didn't really understand any of what I was reading, but I typed in the whole basic sample complete with HWNDs and all that nonsense. I can't remember if I could even get it to compile, but the idea of an event-loop was beyond my comprehension as a 12yo. I'm sure if I went back it would make a lot more sense to me, but back in 1994 it seemed like dark magic, especially compared to the much simpler and more understandable OWL components.
Re: C-Macs – a pure C macOS application
#66Earlier quoted context omitted.
I knew this was possible, but I had never actually seen it implemented before. And to think, the project is over 10 years old! When I first started programming Cocoa, I was always kind of miffed that the happy-path was: "Use Objective-C and main() should just hand-off the reigns to NSApplicationMain()". Kind of like the happy-path on Windows is "WinMain plus a bunch of boilerplate crud". It's always felt somehow vagu…
It has to hand over the reigns to the Objective-C runtime to allow for all the messages being passed between objects. I’m not sure you want to spend your time rewriting what NSApp is doing!
Re: C-Macs – a pure C macOS application
#67Earlier quoted context omitted.
It's not. Open up any of the .c files and you'll see lots of references to Cocoa. One of the comments refers to Cocoa by name! This is using objc_msgSend to call into Cocoa. You'd have to squint your eyes pretty hard for the claim in the readme to be true. What it doesn't have is Objective-C code, which is different than not having Cocoa.
check out the clang objc rewriter - basically c++front for objc. https://www.jviotti.com/2023/12/01/understanding-objective-c...
Re: C-Macs – a pure C macOS application
#68Earlier quoted context omitted.
Full Carbon was there until the 64bit transition officially, but much of it remained and still remains until now. For example, Apple only started using AppKit to draw menus in Sonoma; it was Carbon until now.
I think it’s cool that a lot of NextStep stuff is still there (all those “NS XXX ” calls).
Re: C-Macs – a pure C macOS application
#69Earlier quoted context omitted.
> why this is significant? Ultimately, because new people keep being born and missed the years where this was pretty common and haven't yet bumped into the corners where it still is. The repo and the SO discussion it was inspired by are themselves 11 years old and seem to be rooted in a new generation of iOS app developers starting to get more deeply curious about the system they're running on and how else it might b…
The funny thing is, Apple themselves seems to have forgotten about the whole BSD-rooted operating system. Anybody who ventures off the beaten path of developing software for a modern Mac will inevitably encounter a lot of cobwebs. One of my favorites: When Apple implemented app bundles, they never updated dyld's search paths to be aware of the app bundle directory structure, meaning you have to manually patch your rp…
Re: C-Macs – a pure C macOS application
#70Earlier quoted context omitted.
That has always been possible. Also, under the ObjC layer, is good ol' ANSI C (FreeBSD Unix). There's a number of apps that run on modern Macs, that were written in C, but it is unusual to see ones that leverage the GUI. That said, it's possible to walk from Boston to Portland (OR), but I'd rather take a plane.
I knew this was possible, but I had never actually seen it implemented before. And to think, the project is over 10 years old! When I first started programming Cocoa, I was always kind of miffed that the happy-path was: "Use Objective-C and main() should just hand-off the reigns to NSApplicationMain()". Kind of like the happy-path on Windows is "WinMain plus a bunch of boilerplate crud". It's always felt somehow vagu…