Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage Example / C to Objective-C #3

Open
tsujp opened this issue Jun 7, 2022 · 0 comments
Open

Usage Example / C to Objective-C #3

tsujp opened this issue Jun 7, 2022 · 0 comments

Comments

@tsujp
Copy link

tsujp commented Jun 7, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant