Skip to content

Instantly share code, notes, and snippets.

@campoy
Created April 12, 2018 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save campoy/f24752a7d60c9506eb5daf0e206f6408 to your computer and use it in GitHub Desktop.
Save campoy/f24752a7d60c9506eb5daf0e206f6408 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <dlfcn.h>
int main()
{
int (*sum)(int, int);
void *dl = dlopen("sum.so", RTLD_LAZY);
if (!dl)
{
fprintf(stderr, "%s\n", dlerror());
return 1;
}
sum = dlsym(dl, "sum");
printf("%d\n", (*sum)(39, 3));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment