lundi 13 février 2017

What is the significance of a Mach-O dylib LC_ID_DYLIB name, or install_name?

Vote count: 0

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 section would need information on where to find a binary, but why does a dylib need information on where to find itself? The binary that links against should be the one that finds it?

So what exactly does a macOS dylib LC_ID_DYLIBinstall_name do?

asked 41 secs ago

Let's block ads! (Why?)



What is the significance of a Mach-O dylib LC_ID_DYLIB name, or install_name?

Aucun commentaire:

Enregistrer un commentaire