From: <sg...@us...> - 2003-10-14 03:18:27
|
Update of /cvsroot/libfunutil/libfunutil/toc/tests/c In directory sc8-pr-cvs1:/tmp/cvs-serv5960/toc/tests/c Added Files: check_for_dlopen_and_friends.c Makefile Log Message: egg --- NEW FILE: check_for_dlopen_and_friends.c --- /** Quick check for dlopen(), dlclose() and dlsym(). toc usage: toc_run_fail path/to/this/file -ldl -export-dynamic */ #include <dlfcn.h> #include <stdlib.h> void foo_function() {} int main() { typedef void (*func)(); void * soh = dlopen( 0, RTLD_NOW | RTLD_GLOBAL ); if( ! soh ) { printf( "%s\n", dlerror() ); return 1; } void * sym = (func) dlsym( soh, "foo_function" ); if( 0 == sym ) { printf( "%s\n", dlerror() ); return 2; } int err = dlclose( soh ); if( err ) { printf( "%s\n", dlerror() ); return err; } return 0; } --- NEW FILE: Makefile --- include toc.make DIST_FILES += $(wildcard *.c) all: |