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

source code of lldb/test/API/tools/lldb-dap/module-event/main.cpp