blob: 711471b9fadd0a7056cbd0b75c4edd0be9f96298 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include <dlfcn.h>
#include <stdio.h>
int main(int argc, char const *argv[]) {
#if defined(__APPLE__)
const char *libother_name = "libother.dylib";
#else
const char *libother_name = "libother.so";
#endif
printf("before dlopen\n"); // breakpoint 1
void *handle = dlopen(libother_name, RTLD_NOW);
int (*foo)(int) = (int (*)(int))dlsym(handle, "foo");
foo(12);
printf("before dlclose\n"); // breakpoint 2
dlclose(handle);
printf("after dlclose\n"); // breakpoint 3
return 0; // breakpoint 1
}
|