Re: Simple question on locating dynamic libraries at runtime
Re: Simple question on locating dynamic libraries at runtime
- Subject: Re: Simple question on locating dynamic libraries at runtime
- From: Sherm Pendley <email@hidden>
- Date: Wed, 4 Aug 2010 15:56:25 -0400
On Wed, Aug 4, 2010 at 3:25 PM, Chris Goedde <email@hidden> wrote:
>
> The library itself [libeng.dylib] lives in /Applications/MATLAB_R2009a.app/bin/maci
...
> Dyld Error Message:
> Library not loaded: @loader_path/libeng.dylib
At run time, the dynamic loader expands @loader_path to the location
of whatever binary loaded the .dylib, which in the case of an app
bundle is Foo.app/Contents/MacOS. Try copying the library to that
location inside your own app bundle.
> I guess I could copy the library itself into my project, but I would rather not do that
Based on the fact that they built the library using a @loader_path
prefix, it would appear that's what the Matlab devs want you to do.
When in Rome, do as the Romans do... :-)
> because I'm afraid it'll create more work for me every time I upgrade Matlab.
That depends - if the library is standalone, i.e. if it doesn't have
any dependencies beyond the library itself, then copying it into your
app bundle will *prevent* upgrades from affecting your app. It will
always have the library version it was built with, even if the Matlab
app itself is upgraded or even deleted.
On the other hand, if it depends on other resources that are supposed
to be found in a location that's relative to the library, then you
might need to copy those resources into your app as well.
Either way, making your .app bundle as self-contained as possible is
the Way It's Done (tm) on Mac OS X. Asking Mac users to muck around
with environment variables, or to run an installer to put the library
in /usr/local, is a good way to have some unhappy users. Of course, if
you're the only user, that's not a concern.
sherm--
--
Cocoa programming in Perl:
http://www.camelbones.org
_______________________________________________
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