I'm working on developing a macOS dylib framework, developed outside of Xcode, and I'm trying to understand the significance of the install_name
option.
For example, I can set the LC_ID_DYLIB
section name
to something more-like what you would find in a application bundle's framework using the install_name
argument like so.
clang++ ... -install_name @executable_path/../Frameworks/somelib.framework/Versions/somelib ...
Then with otool -l
I can see that my name has been set in the binary, different from the default (which matches the -o
option by default).
otool -l somelib
...
cmd LC_ID_DYLIB
cmdsize 96
name @executable_path/../Frameworks/somelib.framework/Versions/A/somelib (offset 24)
time stamp 1 Wed Dec 31 19:00:01 1969
current version 1.0.0
compatibility version 1.0.0
....
So I understand how to set it, but what I don't understand is what exactly the value is used for to know what it should be, nor can I find any documentation on it.
I can see why the LC_LOAD_DYLIB
sections would need information on where to find a binary (as these sections reference other binaries), but why does a dylib need information on where to find itself? The binary that links against it should be the one that finds it?
So what exactly does a macOS dylib LC_ID_DYLIB
install_name
do?