Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > DoxygentestModule.c
Go to the documentation of this file.
00001 /* 00002 * testModule.c : a small tester program for xmlModule 00003 * 00004 * See Copyright for the status of this software. 00005 * 00006 * joelwreed@comcast.net 00007 */ 00008 00009 #include "libxml.h" 00010 #ifdef LIBXML_MODULES_ENABLED 00011 #include <libxml/xmlversion.h> 00012 00013 #include <limits.h> 00014 #include <stdio.h> 00015 #include <string.h> 00016 #include <stdarg.h> 00017 00018 #include <libxml/xmlmemory.h> 00019 #include <libxml/debugXML.h> 00020 #include <libxml/xmlmodule.h> 00021 00022 #ifdef _WIN32 00023 #define MODULE_PATH "." 00024 #include <stdlib.h> /* for _MAX_PATH */ 00025 #ifndef __MINGW32__ 00026 #define PATH_MAX _MAX_PATH 00027 #endif 00028 #else 00029 #define MODULE_PATH ".libs" 00030 #endif 00031 00032 /* Used for SCO Openserver*/ 00033 #ifndef PATH_MAX 00034 #ifdef _POSIX_PATH_MAX 00035 #define PATH_MAX _POSIX_PATH_MAX 00036 #else 00037 #define PATH_MAX 4096 00038 #endif 00039 #endif 00040 00041 typedef int (*hello_world_t)(void); 00042 00043 int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { 00044 xmlChar filename[PATH_MAX]; 00045 xmlModulePtr module = NULL; 00046 hello_world_t hello_world = NULL; 00047 00048 /* build the module filename, and confirm the module exists */ 00049 xmlStrPrintf(filename, sizeof(filename), 00050 (const xmlChar*) "%s/testdso%s", 00051 (const xmlChar*)MODULE_PATH, 00052 (const xmlChar*)LIBXML_MODULE_EXTENSION); 00053 00054 module = xmlModuleOpen((const char*)filename, 0); 00055 if (module) 00056 { 00057 if (xmlModuleSymbol(module, "hello_world", (void **) &hello_world)) { 00058 fprintf(stderr, "Failure to lookup\n"); 00059 return(1); 00060 } 00061 if (hello_world == NULL) { 00062 fprintf(stderr, "Lookup returned NULL\n"); 00063 return(1); 00064 } 00065 00066 (*hello_world)(); 00067 00068 xmlModuleClose(module); 00069 } 00070 00071 xmlMemoryDump(); 00072 00073 return(0); 00074 } 00075 00076 #else 00077 #include <stdio.h> 00078 int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { 00079 printf("%s : Module support not compiled in\n", argv[0]); 00080 return(0); 00081 } 00082 #endif /* LIBXML_SCHEMAS_ENABLED */ Generated on Sun May 27 2012 04:34:42 for ReactOS by
1.7.6.1
|