[SOLVED] Re: Loading CFM from Mach-o...
[SOLVED] Re: Loading CFM from Mach-o...
- Subject: [SOLVED] Re: Loading CFM from Mach-o...
- From: Dave Thorup <email@hidden>
- Date: Wed, 21 Jan 2004 11:00:22 -0500
Thanks to a suggestion of one of my coworkers I was able to get this
working. The problem was C++ name mangling. In the CodeWarrior simple
shared library example (that exports a BeepTwice() function) the source
file is a ".cp" file meaning it was being compiled as C++. If I put an
'extern "C"' around the function declaration then the symbol is
exported properly without mangling:
#pragma export on
extern "C" {
int BeepTwice( void );
}
#pragma export off
Of course I could probably just change the source file to ".c" and that
would work too.
Now I can successfully load the Bundle with a CFM shared library
(shlb), find the "BeepTwice" symbol, and run the code in both of my
simple Carbon and Cocoa Mach-o applications!.
Bundles rock!
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.