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_PATH
on OSX or its equivalent LD_PREOAD
on Linux.
I want to do this on OSX, but this question is a generic one.
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.