Possibly, the last line could equally be:
install_name libfoo.2.dylib compatibility_version 3.0.0 current_version 3.2.15
That would have the same effect on Darwin, if applied consistently.
The encoded current_version is for informational purposes only, nothing uses it, compatibility_version is used by dyld (darwin's dynamic linker) when loading libraries. It checks that the library version it loaded has a compatibility_version greater than or equal to the one it saw when it was created by the static linker.
An example is attached.
Peter -- Peter O'Gorman - http://www.pogma.com
peter% emacs lib.c
peter% cc -dynamiclib -o libbill.dylib lib.c -compatibility_version 1.0
-current_version 0.9
peter% otool -L libbill.dylib
libbill.dylib:
libbill.dylib (compatibility version 1.0.0, current version 0.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 71.1.3)
peter% cat lib.c
int libval() { return 1; }
peter% echo 'int main() { return libval(); }' > main.c
peter% cc -o main main.c ./libbill.dylib
peter% ./main
peter% echo $?
1
peter% perl -pi -e 's/1/2/' lib.c
peter% cat lib.c
int libval() { return 2; }
peter% cc -dynamiclib -o libbill.dylib lib.c -compatibility_version 900.0
-current_version 999.9
peter% otool -L libbill.dyliblibbill.dylib:
libbill.dylib (compatibility version 900.0.0, current version 999.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 71.1.3)
peter% ./mainpeter% echo $?2
peter% perl -pi -e 's/1/3/' lib.c peter% cc -o main
main.c ./libbill.dylibpeter% ./main
peter% echo $?
2
peter% cc -dynamiclib -o libbill.dylib lib.c -compatibility_version 899.0
-current_version 1000
peter% ./maindyld: ./main version mismatch for library: libbill.dylib
(compatibility version of user: 900.0.0 greater than library's version: 899.0.0)
Trace/BPT trap
_______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool
