C++ and Objectiv-C/iOS

Aug 11, 2013 at 7:34pm
NEW QUESTION:
Does anyone know where I could get/buy a book or tutorial on writing wrappers? To link them into my C++ app?

OLD QUESTION:
Hey guys this is probably a common question among forums but I just keep having my doubts about a few things... I've heard it is possible to make you're apps in C++ and use some sort of "wrapper" to make all these functions work on the iOS platform (iPads/iPhones)

So my question is, if I make an app. in C++, for instance, would it be hard or would it take too much time to make it work in iOS?

What is you're opinion, and you're experiences with this?

Learning Objective-C at the moment is a problem in terms of time it takes since I rather stick with C/C++ since I'm studying electronics engineering...
Last edited on Aug 16, 2013 at 7:49pm
Aug 11, 2013 at 9:48pm
http://en.wikipedia.org/wiki/Objective-C#Objective-C.2B.2B

Appearently it is possible (to do without a wrapper) but it looks like there are some pretty painful restrictions
Last edited on Aug 11, 2013 at 9:52pm
Aug 11, 2013 at 10:49pm
closed account (N36fSL3A)
It seems like my posts aren't even sending. I posted one a few minutes after you made the topic...

Anyway, I said that, like C++, Objective C is a C superset from what I read.

You should be able to code your apps in C.
Aug 12, 2013 at 4:31am
In order to work with Cocoa you need to use an oddball language called "Objective C++".
http://cocoadev.com/ObjectiveCPlusPlus

Write your wrapper functions in .mm files and link them into your C++ application, so you can call them like any other function from your C++ code.
Aug 16, 2013 at 7:32pm
Thank you all for your answers! It has helped me a bunch, sorry for taking a few days to reply.

Does anyone know where I could get/buy a book or tutorial on writing wrappers?

Thanks again!
Aug 17, 2013 at 1:11pm
This guy gives a good run down on wrapping C++ objects using Objective C++. I've had to do this myself and I second his advice - segregate code of each language using thin wrappers.

http://robnapier.net/blog/wrapping-cppfinal-edition-759

Mixing the two languages all over the place will only leave you open to often obscure and confusing bugs. Not to mention your code will get increasingly more difficult to read. Good design is also a must.

Happy coding :-)
Topic archived. No new replies allowed.