Loading CFM from Mach-o...
Loading CFM from Mach-o...
- Subject: Loading CFM from Mach-o...
- From: Dave Thorup <email@hidden>
- Date: Wed, 21 Jan 2004 01:25:39 -0500
I'm trying to figure out how to load a CFM shared library (shlb) in a
Mach-o application (not necessarily Cocoa). From what I've read, the
easiest way should be to use the CFBundle methods
CFBundleLoadExecutable & CFBundleGetFunctionPointerForName. To make
things simple I started with the basic CodeWarrior Carbon shared
library template that creates a shlb with one function, BeepTwice.
I then put the generated shlb into a Bundle structure using Aladdin
Systems' MakeBundle application (I also did it manually as well). I
created a simple application (tried both Carbon and Cocoa) that loads
the Bundle and then tries to load the function pointer for "BeepTwice"
using CFBundleGetFunctionPointerForName. Everything works fine and the
Bundle is loaded correctly until I try to load the function pointer.
Whenever I try to do this all I get is NULL. Does anyone know how to
do this? or have an example of how to do this?
Here's the relevant code:
void loadBundle()
{
CFBundleRef newBundle;
// ... code here successfully loads the bundle
// The plug-in was located. Now locate the interface.
if( newBundle )
{
if (CFBundleLoadExecutable(newBundle))
{
void ((*beepProc)());
beepProc = CFBundleGetFunctionPointerForName(newBundle,
CFSTR("BeepTwice"));
}
}
}
I've confirmed that newBundle is loaded properly and everything works
until I try to load the function pointer. Anyone know what I might be
doing wrong?
Thanks!
Dave
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.