• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: loading dynamic library at runtime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: loading dynamic library at runtime


  • Subject: Re: loading dynamic library at runtime
  • From: Ken Thomases <email@hidden>
  • Date: Mon, 18 May 2009 16:27:02 -0500

On May 18, 2009, at 2:10 PM, Kurt Sutter wrote:

Therefore, is there a more elegant way to do this? Can our app tell the loader to automatically link our app to some other library than the one under /System/Library/Python.framework?

See "man dyld", in particular DYLD_FRAMEWORK_PATH and/or DYLD_LIBRARY_PATH.


The problem, though, is it sounds like your application is directly linked against Python. Is that so? If so, then it can't influence how the dynamic loader loads it, because it's already loaded by the time it gets to do anything.

If you dynamically load a bundle at run time, and that bundle is what's directly linked to the Python framework, then it may work to set those environment variables. I'm not sure, though. They may be checked only when dyld starts, early in your process lifetime.

So, you may have to find a way to launch a subprocess to do your real work. Or, have a tool to launch your application after first setting those variables. Or, simply, force your users to set them manually before launching your app:

DYLD_FRAMEWORK_PATH=/path/to/other/Python.framework /path/to/ YourApp.app/Contents/MacOS/YourApp &

(Using Launch Services or the "open" command won't work. It doesn't convey the environment variables to the launched process.)

Good luck,
Ken

_______________________________________________
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


References: 
 >loading dynamic library at runtime (From: Kurt Sutter <email@hidden>)

  • Prev by Date: loading dynamic library at runtime
  • Next by Date: Re: Xcode concept of svn repositories
  • Previous by thread: loading dynamic library at runtime
  • Next by thread: Re: loading dynamic library at runtime
  • Index(es):
    • Date
    • Thread