Rev 3589 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3589 | Rev 3686 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | /** |
33 | /** |
34 | * @file |
34 | * @file |
35 | */ |
35 | */ |
36 | 36 | ||
37 | #include <stdio.h> |
37 | #include <stdio.h> |
- | 38 | #include <stdlib.h> |
|
- | 39 | #include <dlfcn.h> |
|
38 | 40 | ||
39 | static void kputint(unsigned i) |
41 | static void kputint(unsigned i) |
40 | { |
42 | { |
41 | // unsigned dummy; |
43 | // unsigned dummy; |
42 | // asm volatile ( |
44 | // asm volatile ( |
Line 58... | Line 60... | ||
58 | */ |
60 | */ |
59 | } |
61 | } |
60 | 62 | ||
61 | int main(int argc, char *argv[]) |
63 | int main(int argc, char *argv[]) |
62 | { |
64 | { |
- | 65 | void *a; |
|
- | 66 | void *s; |
|
- | 67 | ||
- | 68 | char *lib_name; |
|
- | 69 | char *sym_name; |
|
- | 70 | ||
63 | // kputint(-1); |
71 | // kputint(-1); |
64 | printf("Hello from dltest!\n"); |
72 | printf("Hello from dltest!\n"); |
- | 73 | ||
- | 74 | lib_name = "libc.so.0"; |
|
- | 75 | sym_name = "printf"; |
|
- | 76 | ||
- | 77 | a = dlopen(lib_name, 0); |
|
- | 78 | if (a != NULL) { |
|
- | 79 | s = dlsym(a, sym_name); |
|
- | 80 | printf("symbol '%s' = 0x%lx\n", sym_name, (long) s); |
|
- | 81 | } else { |
|
- | 82 | printf("failed to dlopen() library '%s'\n"); |
|
- | 83 | } |
|
65 | return 0; |
84 | return 0; |
66 | } |
85 | } |
67 | 86 | ||
68 | /** @} |
87 | /** @} |
69 | */ |
88 | */ |