i found a great post Calling Objective-C method from C++ method?
however, i have to 2 questions, which makes me overcoming this issue very problematic :
note that i have made a change to MyObject-C-Interface.h
#ifndef __MYOBJECT_C_INTERFACE_H__ #define __MYOBJECT_C_INTERFACE_H__ 1 struct CWrap { void * myObjectInstance; int MyObjectDoSomethingWith (void *parameter) { //how to call the //myObjectInstance->MyObjectDoSomethingWith ??? } } #endif 1) how can i call a method on a void * myObjectInstance…
i mean, i cannot cast to MyObject or otherwise let the compiler know, what method to call:(
2) how do i actually use it?
in my, lets say code.m that has both the
#import "MyObject.h" //and #include "MyObject-C-Interface.h" i would do?
MyObject tmp = [[MyObject alloc] init]; CWrap _cWrap; _cWrap.myObjectInstance = (void *)tmp; //pass the CWrap to a deep C++ nest myMainCPPCode->addObjectiveCToCWrap(_cWrap); and than in my deep C++ code simply call
_cWrap.MyObjectDoSomethingWith((void *)somePrameter) iam missing a link, and thats, how to link the C wraper function to a ObjectiveC function :(
thank you