I am having the opposite problem that Can you compile a shared object to prefer local symbols even if it's being loaded by a program compiled with -rdynamic? is solving.
Using the naming from the linked question, I have a dynamic library where baz
calls bar
, and I have a test binary exercising the library, which substitutes its own fake implementation of bar
for test purposes. This works fine on Linux, because -rdynamic
is used to link.
The source of the test is https://github.com/apache/qpid-dispatch/blob/b172f501028b36d786b4c83bcee1e195cd17fcf2/tests/timer_test.c. The functions being mocked are, among others qd_server_timeout
and qd_timer_now
(that is the inlined one, see comments).
I am at a loss how to achieve the same on macOS. What are the correct linker options there?