/branches/dynload/uspace/app/dltest/dltest.c |
---|
35,6 → 35,8 |
*/ |
#include <stdio.h> |
#include <stdlib.h> |
#include <dlfcn.h> |
static void kputint(unsigned i) |
{ |
60,8 → 62,25 |
int main(int argc, char *argv[]) |
{ |
void *a; |
void *s; |
char *lib_name; |
char *sym_name; |
// kputint(-1); |
printf("Hello from dltest!\n"); |
lib_name = "libc.so.0"; |
sym_name = "printf"; |
a = dlopen(lib_name, 0); |
if (a != NULL) { |
s = dlsym(a, sym_name); |
printf("symbol '%s' = 0x%lx\n", sym_name, (long) s); |
} else { |
printf("failed to dlopen() library '%s'\n"); |
} |
return 0; |
} |