repo.or.cz
/
valgrind.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
coregrind/m_gdbserver/remote-utils.c (prepare_resume_reply): Use memcpy
[valgrind.git]
/
drd
/
tests
/
dlopen_main.c
blob
f879735b38d50d5181551a47c6eec982f6cf6b05
1
#include <stdlib.h>
2
#include <stdio.h>
3
#include <dlfcn.h>
4
#include
"dlopen_lib.h"
5
6
int
main
(
int
argc
,
char
**
argv
)
7
{
8
const char
*
lib
=
argc
>
1
?
argv
[
1
] :
"./libfoo.so"
;
9
void
*
handle
;
10
void
(*
function
)();
11
const char
*
error
;
12
13
handle
=
dlopen
(
lib
,
RTLD_NOW
);
14
if
(!
handle
) {
15
fputs
(
dlerror
(),
stderr
);
16
exit
(
1
);
17
}
18
19
function
=
dlsym
(
handle
,
"foo"
);
20
error
=
dlerror
();
21
if
(
error
) {
22
fputs
(
error
,
stderr
);
23
exit
(
1
);
24
}
25
26
(*
function
)();
27
dlclose
(
handle
);
28
return
0
;
29
}