coregrind/m_gdbserver/remote-utils.c (prepare_resume_reply): Use memcpy
[valgrind.git] / drd / tests / dlopen_main.c
blobf879735b38d50d5181551a47c6eec982f6cf6b05
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <dlfcn.h>
4 #include "dlopen_lib.h"
6 int main(int argc, char **argv)
8 const char *lib = argc > 1 ? argv[1] : "./libfoo.so";
9 void *handle;
10 void (*function)();
11 const char *error;
13 handle = dlopen(lib, RTLD_NOW);
14 if (!handle) {
15 fputs (dlerror(), stderr);
16 exit(1);
19 function = dlsym(handle, "foo");
20 error = dlerror();
21 if (error) {
22 fputs(error, stderr);
23 exit(1);
26 (*function)();
27 dlclose(handle);
28 return 0;