Well I couldn't find very nice short phrase for my question title, but here is what I mean:
I have a library that interposes some syscalls like open(2)
.
I use this method for interposing. I add it to DYLD_INSERT_LIBRARIES
in order to achieve my goal.
The library that contains the interposing code is a.dylib
.
I need to link a library b.dylib
to a.dylib
because it contains some functions that a.dylib
needs.
The issue is a.dylib
interposes functions in b.dylib
too which I don't want.
I am not an expert with linking. Is there any way to prevent this behaviour and what's the reason behind this happening?
UPDATE:
This is how b.dylib
is built:
clang -dynamiclib -fPIC -Wextra -Wall -pedantic -Wl,-single_module <object files> -o b.dylib -install_name <path>
This is how a.dylib
is built:
clang -dynamiclib -fPIC -Wextra -Wall -pedantic -Wl,-single_module <object files> -o a.dylib -install_name <path> b.dylib
Only a.dylib
is added to the end of DYLD_INSERT_LIBRARIES
.