Friday, February 24, 2012

Objective-c calling C function


Hello i want to call a c Function from an objective c method how can i do that?



here is my function




static BOOL test () {

....


if(...){
return YES;
}else{
return NO;
}
....
}

1 comment:

  1. Just as you will in a C program:

    -(void) myVoidMethod {
    BOOL res;
    res = test();
    }


    Don't forget to declare / include relevant header (again, just like in a C program).

    Also, as daknøk mentioned, Objective-C is a strict superset of C, so what works with C - works with Objective-C.

    ReplyDelete