# Problems linking to .dylib

**URL:** <https://forum.juce.com/t/problems-linking-to-dylib/35675>\
**Category:** General JUCE discussion\
**Created:** [October 14, 2019, 2:33pm UTC](https://forum.juce.com/t/problems-linking-to-dylib/35675 "2019-10-14T14:33:44Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Achder](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/achder/32/5897_2.png) [@Achder](https://forum.juce.com/u/Achder)\
**Post date:** [October 14, 2019, 5:23pm UTC](https://forum.juce.com/t/problems-linking-to-dylib/35675/2 "2019-10-14T17:23:19Z")

</div>

Oh okay, I found the solution by myself.  
In case of a plugin, @executable\_path resolves to the DAWs executable. @loader\_path resolves to the plugins path when its loaded inside a DAW.

So I just switched the install name of the lib back to `@rpath/mylib.dylib` using:

```auto
install_name_tool -id @rpath/mylib.dylib mylib.dylib

```

And then I add two new rpaths to the resulting executable using:

```auto
install_name_tool -add_rpath @executable_path/../Frameworks
install_name_tool -add_rpath @loader_path/../Frameworks

```

This way the executable looks in these two directories for the .dylib. First one is for standalone use, second one for plugins.

Last but not least, copy the actual .dylib into the bundle under `Contents/Frameworks/` so it can be found.

See also:  
[https://wincent.com/wiki/%40executable\_path%2C\_%40load\_path\_and\_%40rpath](https://wincent.com/wiki/%40executable_path%2C_%40load_path_and_%40rpath)

---

_[View the full topic](https://forum.juce.com/t/problems-linking-to-dylib/35675)._
