diff options
Diffstat (limited to 'testsuite/gna/issue1623/load.c')
-rw-r--r-- | testsuite/gna/issue1623/load.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/gna/issue1623/load.c b/testsuite/gna/issue1623/load.c new file mode 100644 index 000000000..5e45b3a70 --- /dev/null +++ b/testsuite/gna/issue1623/load.c @@ -0,0 +1,28 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +int main(int argc, char** argv) { + + void* h = dlopen(argv[1], RTLD_LAZY); + if (!h){ + fprintf(stderr, "dlopen: %s\n", dlerror()); + exit(1); + } + + typedef int main_t(int, char**); + + main_t* entry = (main_t*)dlsym(h, "entry"); + if (!entry){ + fprintf(stderr, "dlsym: %s\n", dlerror()); + exit(2); + } + + printf("Call entry\n"); + printf("Return from entry: %d\n", entry(0, NULL)); + + dlclose(h); + + return 0; + +} |