Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Using .dylib with a CFM Application



> On Thu, 19 Jan 2006 15:54:56 -0500, "Pierre Thibault" <email@hidden>
> wrote:
> > I have .dylib files not .so files. I don't know if it the same. I
> > created a bundle in Xcode. Then, I added the .dylib, 5 of them, in
the
> > MacOS folder of my bundle. The problem that I have is with the
> > references. I made a script that uses install_name_tool with the
magic
> > @executable_path word. But this is not working. I have to use
absolute
> > paths with my dylibs otherwise it does not work.
> 

George Warner wrote:
> Note that install_name_tool can usually only change the install path
if
> the
> new path is not longer than the install path that the dylib was
originally
> built with. 

I am pretty lucky with the libraries that I have because they are able
to take long paths. But I guess it could be a problem if they user nests
my application too deep in its file system. But, what can I do?

I can build the libraries already with the good paths too but I won't be
able to link in Xcode my application if I do so (Xcode does not link
when I change the paths). And it is not really a solution because
depending where these are used, the references to use won't be the same.

George Warner wrote:
>You should double check your dylib's path by using otool's "-
> L"
> option. (I'd suggest building with the correct path in the first place
and
> not depending on the install_name_tool.)

Yes. I already did that. Everything is ok because I use the same script
to correct the paths that I did for my application. I have the same
result and my application, I have another application using the dylib
directly, is working fine.

I found some answer to my problem. Here at Bob, from Omnigroup, as to
say:

-----------------------------------------
You can't, dyld doesn't support a relative reference to a loading 
bundle.  Basically, you can load it from a known place (forcing the 
user to install your bundle in a particular place), build+link your 
libraries statically, or use the NSBundle/dyld APIs yourself and get 
references to the symbols you use (can be a pain, but entirely 
possible).
-----------------------------------------

So what I did is 5 bundles. One for each dylib. I added all these bundle
inside another bundle. Each dylib as its own bundle with the same (I
removed the .dylib extension).

This solution works fine but I have to change find the path of the
application and then I must change the paths of the dylib accordingly
with an absolute path. The bad thing of this solution is the fact that I
must run a script at the run time to modify my application. It is not
very neat and I don't like the idea. But it is working and it is the
best solution that I found.

If you have something better, just tell me.

George Warner wrote:
> Can you post you "otool -L" output? Maybe it won't "look fine" to us.
;-)

Well, if Bob is right, I believe he is, I just can't use
@executable_path in a bundle and I must use absolute paths.

Regards, Pierre.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.