Uh oh!
There was an error while loading. Please reload this page.
forked from GNOME/libxml2
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestModule.c
More file actions
Latest commit
84 lines (68 loc) · 1.82 KB
/
Copy pathtestModule.c
File metadata and controls
84 lines (68 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* testModule.c : a small tester program for xmlModule
*
* See Copyright for the status of this software.
*
* Author: Joel W. Reed
*/
#defineXML_DEPRECATED
#include"libxml.h"
#include<stdio.h>
#include<libxml/xmlversion.h>
#ifdefLIBXML_MODULES_ENABLED
#include<limits.h>
#include<string.h>
#include<stdarg.h>
#include<libxml/xmlmemory.h>
#include<libxml/xmlmodule.h>
#include<libxml/xmlstring.h>
#ifdef_WIN32
#defineMODULE_PATH "."
#include<stdlib.h>/* for _MAX_PATH */
#ifndef__MINGW32__
#definePATH_MAX _MAX_PATH
#endif
#else
#defineMODULE_PATH ".libs"
#endif
/* Used for SCO Openserver*/
#ifndefPATH_MAX
#ifdef_POSIX_PATH_MAX
#definePATH_MAX _POSIX_PATH_MAX
#else
#definePATH_MAX 4096
#endif
#endif
typedefint (*hello_world_t)(void);
intmain(intargcATTRIBUTE_UNUSED, char**argvATTRIBUTE_UNUSED) {
xmlCharfilename[PATH_MAX];
xmlModulePtrmodule=NULL;
hello_world_thello_world=NULL;
/* build the module filename, and confirm the module exists */
xmlStrPrintf(filename, sizeof(filename),
"%s/testdso%s",
(constxmlChar*)MODULE_PATH,
(constxmlChar*)LIBXML_MODULE_EXTENSION);
module=xmlModuleOpen((constchar*)filename, 0);
if (module==NULL) {
fprintf(stderr, "Failed to open module\n");
return(1);
}
if (xmlModuleSymbol(module, "hello_world", (void**) &hello_world)) {
fprintf(stderr, "Failure to lookup\n");
return(1);
}
if (hello_world==NULL) {
fprintf(stderr, "Lookup returned NULL\n");
return(1);
}
(*hello_world)();
xmlModuleClose(module);
return(0);
}
#else
intmain(intargcATTRIBUTE_UNUSED, char**argvATTRIBUTE_UNUSED) {
printf("%s : Module support not compiled in\n", argv[0]);
return(0);
}
#endif/* LIBXML_MODULES_ENABLED */