What is the best way to port from Objective-C to C ++?

I have no experience with Objective-C, but I have a strong background in C ++. Is there an automated / script tool or, in the worst case, some kind of manual method using an excellent link to the port code written in Objective-C in C ++? What are the difficulties?

Edit: I was told that the code using Objective-C is pretty trivial. This is an application for the iPhone, which is probably not much different from the user level interface of the OS. The C ++ version is for a platform other than Apple, where GNUStep is not an option, so Objective-C ++ is not an option.

+6
c ++ objective-c
source share
3 answers

I worked on the same issue. And you have several solutions:

  • Microsoft now offers its own Objective-C "bridge", although only for UWP applications.

    https://github.com/Microsoft/WinObjC

  • In 2007, I tried to support Objective-C in Visual Studio and wrote my own ObjC runtime, but I donโ€™t have more time to write a parser for it. If you have, you can :)

    http://code.google.com/p/qobjc/

  • I wrote the basic functionality of the Foundation Framework in C ++. In this case, you need to manually place the port; your code will be in C ++, but it will be similar to Objective-C. This library worked on the iPhone.

    http://code.google.com/p/dcocoa/

+6
source share

There are no automated tools that I know of. The dynamic nature of Objective-C is very difficult to translate into C ++, so for all but the trivial code of Objective-C, a lot of effort is required for the brain. Are you ready to stay on OS X (or keep the GNUStep dependency if you are one of the few people using Objective-C on an OS other than OS X)? If so, it is easiest to use Objective-C ++ to build a bridge with Objective-C and C ++ code. Objective-C ++ is the Apple extension for Objective-C and the GCC compiler, which allows you to mix Objective-C and C ++ code. That way, you can create Objective-C objects that call or reference (but don't inherit) C ++ objects, and you can send Objective-C messages to Objective-C instances from C ++ code.

+3
source share

Objective-C was just a pre-processor (and a runtime library). You will find more problems porting all libraries than end-user code. When translating, nothing will change.

Most likely, you will see poor design in all C ++ code after using Objective-C frameworks.

0
source share

All Articles