Circumvent Messaging
Circumvent Messaging
- Subject: Circumvent Messaging
- From: Nicolai <email@hidden>
- Date: Sun, 7 Oct 2001 00:23:32 +0200
Hi all!
I want to call some of my functions directly without
using the messaging mechanism, like here:
@implementation aClass
{
void (*funcPtr)(int, double*);
}
- (id)init()
{
[super init];
funcPtr = (void (*)(int, double*))[target
methodForSelector:@selector(getData:)];
}
- (void)doSomething
{
int i;
double dReturn;
for ( i = 0; i < 1000; i++)
funcPtr(i, &dReturn);
}
- (void)getData:(int)i storeInto:(double*)pDouble
{
...
*pDouble = d; //EXC_BAD_ACCESS thrown
}
@end
When I want to access a member variable of aClass or a
variable through a pointer from getData which was called
via the function pointer in most cases EXC_BAD_ACCESS is
thrown.
Is there anything special about directly calling a
function?
Regards, Nicolai.