Calling Objective-C method from C code -


i'm trying call method implemented in obj-c c code follows:

// mainviewcontroller.m

- (void)test {     [self outputline:@"called mycode.c"]; } . . . cfunc(id param); . . . 

// mycode.c

void cfunc(id param) {     [param test]; // compilation error: parse issue: expected expression } 

i guess happens since mainviewcontroller not declared in mycode.c, when #include mainviewcontroller.h tons of other errors suggests i'm totally wrong... how should handle correctly?

tia

you should compile mycode.c file objective-c. objective-c superset of c, it's not true other way around. can't have objective-c code interspersed "pure c" code if intending compile c.


Comments