Problem in calling function of the loadable bundle!!!
Problem in calling function of the loadable bundle!!!
- Subject: Problem in calling function of the loadable bundle!!!
- From: Jenis Shah <email@hidden>
- Date: Wed, 27 Apr 2005 19:43:54 +0530
Hi all,
I made a simple bundle which has just one function as below:
void fun()
{
static int i=0;
return ++i;
printf("The value of i is %d",i);
}
Now I wrote a code to call this function from outside the bundle:
=====================================================
CFURLRef bundleURL;
CFBundleRef myBundle;
// Make a CFURLRef from the CFString representation of the
// bundle's path.
bundleURL = CFURLCreateWithFileSystemPath(
kCFAllocatorDefault,
CFSTR("/bundles/MyBundle.bundle"), //where
"/bundles/MyBundle.bundle" is a path
kCFURLPOSIXPathStyle,
true );
// Make a bundle instance using the URLRef.
myBundle = CFBundleCreate( kCFAllocatorDefault, bundleURL );
// call the function of the bundle MyBundle
// Declare the Function pointer.
void (*funptr)() = NULL;
// Get a pointer to the function.
funptr = (void*)CFBundleGetFunctionPointerForName(
myBundle, CFSTR("fun") );
// If the function was found, call it with a test value.
if (funptr)
{
(*funptr)();
}
================================================================
But I am not able to call the function. I am able to create the bundle
successfully.
But while calling the function of it I got the error saying "Program exited
due to Signal 10 ( SIGBUS )".
So please let me know any settings are required in bundle to export the
function ?
OR
Is there any mistake in calling the function of the bundle?
Waiting for the reply....
Thanks,
Jenis Shah
InterraIT Information Technologies Ltd.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden