Load the function:
int (*func)(int x, char *y) = dlsym(dl_handle, "your_function");
You might well decide you need a cast on the return from dlsym()
; it is one of the uglinesses with dynamically loaded libraries.
Invoke it:
int i = 37;
char buffer[64];
int result1 = (*func)(i, buffer); // Old school — pre-C89 (but still works and is explicit)
int result2 = func(i+1, buffer); // New school — can leave you looking for the wrong thing.