• 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: Embedded Library in Cocoa App
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Embedded Library in Cocoa App


  • Subject: Re: Embedded Library in Cocoa App
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 19 Jan 2012 13:25:56 -0800

On Jan 19, 2012, at 11:49 AM, John Nairn wrote:

> I am trying to distribute a Cocoa app that launches my own c++ binaries and those binaries link to a dynamic library,

Is there a reason you can’t compile all the code into your app directly? That would make things a lot simpler. (I know there are valid reasons for having to do it this way, like for example GPL or LGPL libraries.)

> 2. When my c++ code is compiled, it is linked with my installed library which is at /usr/local/lib
>
> 3. When running on Mac that does not have the installed library, I launch my c++ code using an NSTask and set the DYLD_LIBRARY_PATH environment variable to the path to the binaries folder in my application that has the needed library.

You can avoid having to set that variable if you change the dylib’s install name — that way targets that link against it will remember a more appropriate path, like a relative path. You can use “@executable_path” in which case the library will be looked for in the same directory as the executable. You can do this in Xcode in the build settings for the library, or you can also edit the copy of the library you include in your app, via a build script — I don’t know exactly what tool is used to edit the install name, but I’m guessing libtool.

—Jens

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Embedded Library in Cocoa App
      • From: Charles Srstka <email@hidden>
References: 
 >Embedded Library in Cocoa App (From: John Nairn <email@hidden>)

  • Prev by Date: Re: NSTask terminates when NSApplication exits
  • Next by Date: Re: Embedded Library in Cocoa App
  • Previous by thread: Embedded Library in Cocoa App
  • Next by thread: Re: Embedded Library in Cocoa App
  • Index(es):
    • Date
    • Thread