I need to pass Objective C object instance to C++ method trough params. How I can do it?
This code doesn't work, and I know it. I'm just showing what I want.
MyObjcClass *instance = [[MyObjcClass alloc] init];
myCppClassInstance.myCppMethod(instance);
class
is a keyword, so it won't work I agree. But for me there are no other issue in your sample code.
Juste declare your cpp method
void myCppMethod(MyObjcClass *obj) {
}
and use it like you did
MyObjcClass *obj = [[MyObjcClass alloc] init];
myCppMethod(obj);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.