Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

aks86

macrumors newbie
Original poster
Apr 1, 2009
3
0
Greetings!

I am seeking an opinion from the experienced mac developers here about a new project. The idea is to start an open source initiative using swig (http://www.swig.org) for automatically generating the bridge from objective c to c++ so that one can access c++ applications from cocoa.

Apple provides a very good support for mixing objective c and c++ via objective c++ but writing those bridges by hand could be tedious and bug prone. What this project intend to do is to provide a way of automaically generating objective c interfaces and wrappers over c++ so that any cocoa or cocoa touch application happens to see the obeject oriented objective c interface with c++ underneath.

I would greatly appreciate any opinion or suggestions over this idea.

Thanks!
 

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
Hi aks86

Maybe I'm being a bit slow today but I'm not sure I understand exactly what you want to do. I can understand wanting to bridge C++ to Cocoa but I can't see what needs bridging the other way, ie Objective-C to C++.

b e n
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
The way i interpreted it, and this could be way off, the OP wants something that can be fed C++ classes and have an Objective-C class generated for it, perhaps with the original class as an ivar, or perhaps with each method reimplemented in Obj-C methods, etc. I don't feel like I need this, but i guess the gain would be "consistent" method invocation via message passing rather than a mix of dotted or -> method calls and messages passes.

-Lee
 

aks86

macrumors newbie
Original poster
Apr 1, 2009
3
0
I don't feel like I need this, but i guess the gain would be "consistent" method invocation via message passing rather than a mix of dotted or -> method calls and messages passes.

-Lee

Thanks Lee! Infact, that is where my motivation comes from. Given that we do not yet have good objective c solutions, for example,for CORBA and SOAP, and we do have it for C++, it might make sense to wrap c++ libraries to get pure objective c interfaces which can be used from inside cocoa/cocoa touch.
 

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
Ah right.
I haven't looked at swig but I think there might be a problem. In C++ you don't need to declare the names of method parameters in class declarations, yet you would need these to auto-generate the method signatures for the Objective-C class wrappers.

b e n
 

aks86

macrumors newbie
Original poster
Apr 1, 2009
3
0
yah! you are right... its one of the problem that needs to be tackled..and seemingly the only way to tackle is to have appropriate parameter names for arguments, else we can choose to generate arbitrary (but nice looking) method names ourselves...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.