Created
April 12, 2018 18:53
-
-
Save campoy/f24752a7d60c9506eb5daf0e206f6408 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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