Re: Loading dylibs inside of a framework
Re: Loading dylibs inside of a framework
- Subject: Re: Loading dylibs inside of a framework
- From: Graeme Hiebert <email@hidden>
- Date: Fri, 26 Apr 2002 19:09:38 -0700
On Thursday, April 25, 2002, at 07:54 , Richard Schreyer wrote:
I am trying to create a framework that contains some of it's code in
dylib files inside the bundle somewhere.
When an application tries to load the framework, it gives me an error
saying that it couldn't find the files because they were not in the
same directory as the executable. How do I set up the framework so it
knows how to find it's dylibs at runtime?
My solution to this was to break my code into two segments. In my case,
the public API was a bunch of C++ abstract classes, with only two or
three "real" function calls to get/destroy a "session" object; after
that, the session was called to get things rolling. There was also a
whole host of C calls that wrapped the C++ abstract class interface.
My framework's object file included the C wrappers, and the two or three
functions that set up the session. When one of those two or three
functions is called, my framework looks within its package directories
for a particular bundle. This bundle contains the real code for my
framework, complete with 20 or 30 .dylib files that it is linked
against. The framework puts the directory containing the dylib files
into the search path, and then loads the bundle.
This seems to work fine, though I must say that I haven't torture tested
it. In particular, I'm a little afraid that it might break in a
multithreaded environment, if some other thread starts loading some
bundles at the same time that my framework is trying to.
-g
_______________________________________________
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.