2 * testModule.c : a small tester program for xmlModule
4 * See Copyright for the status of this software.
6 * joelwreed@comcast.net
10 #ifdef LIBXML_MODULES_ENABLED
11 #include <libxml/xmlversion.h>
18 #include <libxml/xmlmemory.h>
19 #include <libxml/debugXML.h>
20 #include <libxml/xmlmodule.h>
23 #define MODULE_PATH "."
24 #include <stdlib.h> /* for _MAX_PATH */
26 #define PATH_MAX _MAX_PATH
29 #define MODULE_PATH ".libs"
32 /* Used for SCO Openserver*/
34 #ifdef _POSIX_PATH_MAX
35 #define PATH_MAX _POSIX_PATH_MAX
41 typedef int (*hello_world_t
)(void);
43 int main(int argc ATTRIBUTE_UNUSED
, char **argv ATTRIBUTE_UNUSED
) {
44 xmlChar filename
[PATH_MAX
];
45 xmlModulePtr module
= NULL
;
46 hello_world_t hello_world
= NULL
;
48 /* build the module filename, and confirm the module exists */
49 xmlStrPrintf(filename
, sizeof(filename
),
50 (const xmlChar
*) "%s/testdso%s",
51 (const xmlChar
*)MODULE_PATH
,
52 (const xmlChar
*)LIBXML_MODULE_EXTENSION
);
54 module
= xmlModuleOpen((const char*)filename
, 0);
57 if (xmlModuleSymbol(module
, "hello_world", (void **) &hello_world
)) {
58 fprintf(stderr
, "Failure to lookup\n");
61 if (hello_world
== NULL
) {
62 fprintf(stderr
, "Lookup returned NULL\n");
68 xmlModuleClose(module
);
78 int main(int argc ATTRIBUTE_UNUSED
, char **argv ATTRIBUTE_UNUSED
) {
79 printf("%s : Module support not compiled in\n", argv
[0]);
82 #endif /* LIBXML_SCHEMAS_ENABLED */