You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
327 B
12 lines
327 B
#include <dlfcn.h>
|
|
#include <stdio.h>
|
|
|
|
// Mark foo and bar weak so that Clang allows the run-time linker to decide which DSO's symbol to
|
|
// use.
|
|
|
|
__attribute__((weak)) extern "C" void bar() {
|
|
printf("bar lib2\n");
|
|
void (*next)(void) = reinterpret_cast<void (*)()>(dlsym(RTLD_NEXT, "bar"));
|
|
if (next != nullptr) next();
|
|
}
|