Call an Objective-C function from C++ library code

时光怂恿深爱的人放手 提交于 2020-01-06 07:46:07

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!