Can an executable be linked to a dynamic library after its built?

别说谁变了你拦得住时间么 提交于 2019-12-13 03:53:44

问题


I have built a binary 'foo'. I now want the executable to be a linked to a dynamic library 'bar'. How can I link foo to bar?(using ld or any other way). I don't want to use DYLIB_INSERT_PATHon OSX or its equivalent LD_PREOAD on Linux.

I want to do this on OSX, but this question is a generic one.


回答1:


What's your intention?

The link process resolves symbols: it provide satisfactions to needs.

If the executable doesn't need any symbols offers by the dynamic library, the linker will entirely discard it.

You may replace a dynamic library by another one but you can't resolve a need when it doesn't exists.



来源:https://stackoverflow.com/questions/12789540/can-an-executable-be-linked-to-a-dynamic-library-after-its-built

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