Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: misc.c util.h Log Message: Loadable module support bits. =================================================================== RCS file: /cvs/e/e16/e/src/misc.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -3 -r1.76 -r1.77 --- misc.c 18 May 2007 20:37:11 -0000 1.76 +++ misc.c 28 Aug 2007 18:52:45 -0000 1.77 @@ -319,3 +319,37 @@ } #endif + +#if USE_MODULES +/* + * Dynamic module loading + */ +#include <dlfcn.h> + +void * +ModLoad(const char *name) +{ + char buf[1024]; + void *h; + + Esnprintf(buf, sizeof(buf), "%s/e16/%s.so", ENLIGHTENMENT_LIB, name); + if (EDebug(1)) + Eprintf("ModLoad %s\n", buf); + h = dlopen(buf, RTLD_NOW | RTLD_LOCAL); + if (!h) + Eprintf("*** ModLoad %s: %s\n", buf, dlerror()); + + return h; +} + +void * +ModSym(void *handle, const char *sym) +{ + void *h; + + h = dlsym(handle, sym); + + return h; +} + +#endif /* USE_MODULES */ =================================================================== RCS file: /cvs/e/e16/e/src/util.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- util.h 27 Jul 2007 16:59:50 -0000 1.10 +++ util.h 28 Aug 2007 18:52:45 -0000 1.11 @@ -90,4 +90,10 @@ #endif #endif /* HAVE_SNPRINTF */ +#if USE_MODULES +/* Dynamic loading */ +void *ModLoad(const char *name); +void *ModSym(void *handle, const char *sym); +#endif + #endif /* _UTIL_H_ */ ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs