The iOS and OS X Sdk have a very cool concept of toll-free bridging. If I were to write my own code in C and write Obj-C wrapper for it, and want to use it as Toll-Free-Bridged, how should I do that? Any examples please.
See the tutorial at https://web.archive.org/web/20111013023821/http://cocoadev.com/index.pl?HowToCreateTollFreeBridgedClass. Basically, you need to create a C structure, that has the same size and layout as the obj-c counterpart. Also some funky stuff has to be done to correctly implement retain/release.
The simplest way to do this, if you can, is to write your code in Objective-C, and then wrap it in C. That avoids all of the tricky parts of toll-free bridging (and those tricky parts are only getting trickier. -retain/-release is more complicated if you want to support ARC __weak for example).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With