Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3688 → Rev 3689

/branches/dynload/uspace/app/dltest/dltest.c
60,10 → 60,13
*/
}
 
typedef void (*fptr_t)(void);
 
int main(int argc, char *argv[])
{
void *a;
void *s;
fptr_t fun;
 
char *lib_name;
char *sym_name;
71,8 → 74,8
// kputint(-1);
printf("Hello from dltest!\n");
 
lib_name = "libc.so.0";
sym_name = "printf";
lib_name = "libtest.so.0";
sym_name = "test_func";
 
a = dlopen(lib_name, 0);
if (a != NULL) {
79,8 → 82,14
s = dlsym(a, sym_name);
printf("symbol '%s' = 0x%lx\n", sym_name, (long) s);
} else {
printf("failed to dlopen() library '%s'\n");
printf("failed to dlopen() library '%s'\n", lib_name);
}
 
printf("Run dynamically-resolved function '%s'...\n", sym_name);
fun = (fptr_t) s;
(*fun)();
printf("OK\n");
return 0;
}
 
/branches/dynload/uspace/app/dload/dload.c
79,6 → 79,9
/* Pointer to program module. Used as root of the module graph. */
runtime_env->program = &prog;
 
/* Work around non-existent memory space allocation. */
runtime_env->next_bias = 0x100000;
 
/*
* Now we can continue with loading all other modules.
*/
92,7 → 95,7
 
/* Process relocations in all modules */
DPRINTF("Relocate all modules\n");
modules_process_relocs();
modules_process_relocs(&prog);
 
/* Pass runtime evironment pointer through PCB. */
__pcb->rtld_runtime = (void *) runtime_env;