Is there a way to find the version of a dylib using its path? I am looking for something that accepts the same arguments as dlopen. I have looked at NSVersionOfRunTimeLibrary, but from my reading of the documentation it looks like it gets the version of the current dylib, not the one specified in the path.
Thank you
Run
otool -Lon it, and it will show its actually version. I choose libSystem.B as it has different version in the 10.4 and 10.5 SDKs:(see how the first one has 88.3.11 version, while the second has 111.1.4). This example also shows that not all libraries are symbolic links to files with the version number in them:
Here, the files don’t have the version number in their name.
EDIT: a second solution is to use
NSVersionOfRunTimeLibraryin a test program, in which you force load the library you want to check. Create a programlibversionfrom the following C source:Then, you call it like that:
(here, the version number is printed as hexadecimal, but you can adapt to your needs.)