-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hey, I am trying to hack on macOS a bit and I'd like to call Objective-C methods from C such that I have ideally 0 Objective-C in my codebase at all, perhaps a singular header with or without accompanying source (still C) file getting pointers to Objective-C methods and what not.
I stumbled across this repo but as I am new to Objective-C, Foundation, Cocoa, and other macOS frameworks as a whole I am a bit overwhelmed.
I can see things like this https://github.com/NUIKit/GraphicsServices/blob/master/GraphicsServices/GSCoreFoundationBridge.h where you're (to my understanding) getting pointers to various Objective-C classes and methods for use from C, and also exporting those symbols for use from C via CF_EXPORT.
With all that context is this repo an example of the "purest" one can get with regards to calling Objective-C from C? Following that, can you share how you determined the appropriate struct structures in your headers? Finally, did you have a small hello-world style example (preferably compiled via Makefile)?
I feel like this repo is a hidden gem and I lack the understanding (for now) to utilise it as a general resource for calling Objective-C from C and constructing other bridges to Objective-C APIs from C that I myself might be interested in.