2007年7月4日 星期三

use shared library during runtime

[will@localhost DynamicLibrary]$ cat dl.test.c
#include <dlfcn.h>

#include <stdio.h>

main ()

{

void *libc;

void (*printf_call) ();

if (libc = dlopen ("/lib/libc.so.6", RTLD_LAZY))
{


printf_call = dlsym (libc, "printf");
(*printf_call) ("hello, world\n");

}

dlclose (libc);

}

[will@localhost DynamicLibrary]$

沒有留言:

網誌存檔

關於我自己