install_name_tool difference between -change and -id

青春壹個敷衍的年華 提交于 2019-12-05 11:48:25

My understanding is:

-id: This sets the "install name" that will be used when linking against the dynamic library. It would be run on the target dynamic library file.

-change: This changes the "install name" after linking and would be run on the executable or dynamic library that links against the target dynamic library.

lslboy

install-name_tool -id is used for change the install name of dylib, you can use the otool -D see a dylib install name in the terminal, it will show the default value for you, the /some/path/another_library.dylib is the default install name of another _library.dylib, of course, you can change it use install-name_tool -id in the terminal, just use like this in terminal

install-name_tool -id /some/path/another_library_newname.dylib /some/path/another_library.dylib

now,you use the otool -D /some/path/another_library.dylib, you will find the install name is /some/path/another_library_newname.dylib

here is my example in picture

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!