| 1 | #include "dylib.h" |
|---|---|
| 2 | #include <cassert> |
| 3 | #include <cstdio> |
| 4 | #include <thread> |
| 5 | #include <chrono> |
| 6 | |
| 7 | int main(int argc, char* argv[]) { |
| 8 | // Break here before we dlopen the 'liblib_b.so' shared library. |
| 9 | void* dylib_handle = dylib_open("lib_b"); |
| 10 | assert(dylib_handle && "dlopen failed"); |
| 11 | void (*func_handle)() = (void (*)()) dylib_get_symbol(dylib_handle, "b_function"); |
| 12 | assert(func_handle && "dlsym failed"); |
| 13 | func_handle(); |
| 14 | return 0; |
| 15 | } |
| 16 |
