Reputation: 9431
Two questions:
<SomeProtocol>
in C-function declaration? In function body?(pseudocode)
// myfunc.h
void myfunc(void *object, int param);
// myfunc.c
void myfunc(void *object, int param) {
// desired (pseudocode):
// [<SomeProtocol>(id)object method:param];
}
// objective-c controller
# include "myfunc.h"
// ....
@implementation
- (void)visible_to_outer_world {
Object *o = [Object new];
myfunc(o, 5);
}
// ....
@end
Upvotes: 1
Views: 138
Reputation:
Is it possible to send an Objective-C message to a
void *
from a C function?
Not sure why you would want it, but if you're compiling as Objective-C:
void bar(void *ptr)
{
// MRC version:
[(id)ptr someMessage];
// ARC (alias "ugly") version:
[(__bridge id)ptr someMessage];
}
Foo *foo = [[Foo alloc] init];
bar(foo);
Is it possible to hint
void *
with<SomeProtocol>
in a C function declaration? In a function body?
No.
Upvotes: 5