问题
I'd like to call a Obj-C function from my C++ code, in order to invoke a ShareKit call from a game engine.
How do I perform the Obj-C function call?
I'm using Cocos2d-x.
回答1:
Use Objective-C++. To do that, you make a C++ file with the extension “.mm”. Within that file, both Objective-C and C++ syntax are valid, so you can #import
your Objective-C headers and send messages using the []
syntax.
来源:https://stackoverflow.com/questions/24636264/call-an-objective-c-function-from-c-library-code