I have a quite large C application consisting of several shared libraries. One of the core libraries has a function
void common_function(const char * arg) { ... }
Which is called by all the other libraries. During testing I would like to use a different test implementation of the common_function
.
My plan has been to create a test library containing the alternate implementation of common_function
; is it at all possible to replace the default common_function
runtime using dlopen() / dlsym()
trickery, or alternatively would this link line:
gcc -o test.c -ltest -lcommon
ensure that the common_function
implementation in libtest.so was used also in the libcommon.so - altough the latter has it's own implementation of common_function
.