Re: Linking to a bundle?
Re: Linking to a bundle?
- Subject: Re: Linking to a bundle?
- From: Jim Ingham <email@hidden>
- Date: Tue, 10 Feb 2004 18:06:54 -0800
You need to make a dylib or a framework, not a bundle. You can't link
to bundles, the semantics of bundles are that none of their symbols are
resolved when they are loaded, so it wouldn't make any sense to link to
one. However, you can on-demand load frameworks with the NSAddImage to
load the dylib, and then NSLookupSymbolInImage to pull out the symbols.
If you search in the Xcode Documentation window you can find the docs
for these calls. It is a good idea to pass the
NSADDIMAGE_OPTION_RETURN_ON_ERROR option to NSAddImage or your program
will just abort on error.
Jim
P.S. A minor point: you don't "statically link to as if it were a
dylib". I understand what you were getting at - you want the loader to
take care of finding the library rather than having to do it by hand.
But this is not a STATIC link, that would mean your app was merging the
library's code into itself, which isn't happening here...
Jim
On Feb 10, 2004, at 5:07 PM, Randy Croucher wrote:
Hello,
I have a library that I need users to be able to dynamically load via
CFBundle calls, or statically link to as if it were a dylib (isn't that
all a bundle is anyway is a dylib nested in a couple hidden folders?).
It seems from the reading that I have done that the appropriate way to
make this library is to make it a Bundle. So I created a new target of
type "Carbon Loadable Bundle", and I can load it and execute code in it
via CFBundleCreate and CFBundleGetFunctionPointerForName, but I can't
seem to figure out how to statically link to it.
I have an application that needs to make calls into the above mentioned
bundle, and these calls come up as unresolved from the linker
(obviously). So I drug the product down into the app's "Frameworks and
Libraries" folder, but it did not help. I added -lFoo.bundle to the
"Other Linker Flags", and it didn't work either (I tried a dozen other
variances of this too). Is there a way to explicitly say what to link
to, -lFoo seems to prepend lib and add .a or .dylib on the end so it is
looking for libFoo.a or libFoo.dylib, when my bundle is called
Foo.bundle.
How can I make a dynamic library that works either way? I believe I
could choose to make a target that is a "Carbon Dynamic Library" (I
have linked statically and dynamically to a single one of these). But
I want it to be packaged as a bundle with resources. I suppose I could
make the bundle directory structure myself?
Any help would be greatly appreciated,
Randy
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
Jim Ingham
email@hidden
Developer Tools - gdb
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.