blob: 6cc86ee620b51f6f3c0d8cf649ab43fed04b53e4 [file] [log] [blame]
Daniel Veillardce1648b2005-01-04 15:10:22 +00001/*
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00002 * xmlmodule.c : basic API for dynamic module loading added 2.6.17
Daniel Veillardce1648b2005-01-04 15:10:22 +00003 *
4 * See Copyright for the status of this software.
5 *
6 * joelwreed@comcast.net
Daniel Veillardbe076e92005-01-04 20:18:14 +00007 *
8 * http://www.fortran-2000.com/ArnaudRecipes/sharedlib.html
Daniel Veillardce1648b2005-01-04 15:10:22 +00009 */
10
11#define IN_LIBXML
12#include "libxml.h"
13
14#include <string.h>
15#include <libxml/xmlmemory.h>
16#include <libxml/xmlerror.h>
17#include <libxml/xmlmodule.h>
18#include <libxml/globals.h>
19
20#ifdef LIBXML_MODULES_ENABLED
21
22struct _xmlModule {
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000023 unsigned char *name;
24 void *handle;
Daniel Veillardce1648b2005-01-04 15:10:22 +000025};
26
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000027static void *xmlModulePlatformOpen(const char *name);
28static int xmlModulePlatformClose(void *handle);
Daniel Veillardbe076e92005-01-04 20:18:14 +000029static int xmlModulePlatformSymbol(void *handle, const char *name, void **result);
Daniel Veillardce1648b2005-01-04 15:10:22 +000030
31/************************************************************************
32 * *
33 * module memory error handler *
34 * *
35 ************************************************************************/
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000036
Daniel Veillardce1648b2005-01-04 15:10:22 +000037/**
38 * xmlModuleErrMemory:
39 * @extra: extra information
40 *
41 * Handle an out of memory condition
42 */
43static void
44xmlModuleErrMemory(xmlModulePtr module, const char *extra)
45{
46 const char *name = NULL;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000047
Daniel Veillardce1648b2005-01-04 15:10:22 +000048 if (module != NULL) {
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000049 name = (const char *) module->name;
Daniel Veillardce1648b2005-01-04 15:10:22 +000050 }
51
52 __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_MODULE,
53 XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, extra,
54 name, NULL, 0, 0,
55 "Memory allocation failed : %s\n", extra);
56}
57
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000058/**
59 * xmlModuleOpen:
60 * @name: the module name
Daniel Veillard48df9612005-01-04 21:50:05 +000061 * @options: a set of xmlModuleOption
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000062 *
63 * Opens a module/shared library given its name or path
Daniel Veillard48df9612005-01-04 21:50:05 +000064 * TODO: options are not yet implemented.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000065 *
66 * Returns a handle for the module or NULL in case of error
67 */
68xmlModulePtr
Daniel Veillard48df9612005-01-04 21:50:05 +000069xmlModuleOpen(const char *name, int options ATTRIBUTE_UNUSED)
Daniel Veillardce1648b2005-01-04 15:10:22 +000070{
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000071 xmlModulePtr module;
Daniel Veillardce1648b2005-01-04 15:10:22 +000072
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000073 module = (xmlModulePtr) xmlMalloc(sizeof(xmlModule));
74 if (module == NULL) {
75 xmlModuleErrMemory(NULL, "creating module");
76 return (NULL);
77 }
Daniel Veillardce1648b2005-01-04 15:10:22 +000078
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000079 memset(module, 0, sizeof(xmlModule));
Daniel Veillardce1648b2005-01-04 15:10:22 +000080
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000081 module->handle = xmlModulePlatformOpen(name);
Daniel Veillardce1648b2005-01-04 15:10:22 +000082
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000083 if (module->handle == NULL) {
84 xmlFree(module);
85 __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_MODULE,
86 XML_MODULE_OPEN, XML_ERR_FATAL, NULL, 0, 0,
87 name, NULL, 0, 0, "failed to open %s\n", name);
Daniel Veillard24505b02005-07-28 23:49:35 +000088 return(NULL);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000089 }
90
91 module->name = xmlStrdup((const xmlChar *) name);
92 return (module);
93}
94
95/**
96 * xmlModuleSymbol:
97 * @module: the module
98 * @name: the name of the symbol
Daniel Veillardbe076e92005-01-04 20:18:14 +000099 * @symbol: the resulting symbol address
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000100 *
101 * Lookup for a symbol address in the given module
102 *
Daniel Veillardbe076e92005-01-04 20:18:14 +0000103 * Returns 0 if the symbol was found, or -1 in case of error
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000104 */
Daniel Veillardbe076e92005-01-04 20:18:14 +0000105int
106xmlModuleSymbol(xmlModulePtr module, const char *name, void **symbol)
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000107{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000108 int rc = -1;
109
110 if ((NULL == module) || (symbol == NULL)) {
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000111 __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_MODULE,
112 XML_MODULE_OPEN, XML_ERR_FATAL, NULL, 0, 0,
Daniel Veillardbe076e92005-01-04 20:18:14 +0000113 NULL, NULL, 0, 0, "null parameter\n");
114 return rc;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000115 }
116
Daniel Veillardbe076e92005-01-04 20:18:14 +0000117 rc = xmlModulePlatformSymbol(module->handle, name, symbol);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000118
Daniel Veillardbe076e92005-01-04 20:18:14 +0000119 if (rc == -1) {
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000120 __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_MODULE,
121 XML_MODULE_OPEN, XML_ERR_FATAL, NULL, 0, 0,
Daniel Veillardbe076e92005-01-04 20:18:14 +0000122 name, NULL, 0, 0,
123 "failed to find symbol: %s\n",
124 (name == NULL ? "NULL" : name));
125 return rc;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000126 }
127
Daniel Veillardbe076e92005-01-04 20:18:14 +0000128 return rc;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000129}
130
131/**
132 * xmlModuleClose:
133 * @module: the module handle
134 *
135 * The close operations unload the associated module and free the
136 * data associated to the module.
137 *
138 * Returns 0 in case of success, -1 in case of argument error and -2
139 * if the module could not be closed/unloaded.
140 */
141int
142xmlModuleClose(xmlModulePtr module)
143{
144 int rc;
145
146 if (NULL == module) {
147 __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_MODULE,
Daniel Veillardbe076e92005-01-04 20:18:14 +0000148 XML_MODULE_CLOSE, XML_ERR_FATAL, NULL, 0, 0,
149 NULL, NULL, 0, 0, "null module pointer\n");
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000150 return -1;
151 }
152
153 rc = xmlModulePlatformClose(module->handle);
154
155 if (rc != 0) {
156 __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_MODULE,
Daniel Veillardbe076e92005-01-04 20:18:14 +0000157 XML_MODULE_CLOSE, XML_ERR_FATAL, NULL, 0, 0,
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000158 (const char *) module->name, NULL, 0, 0,
Daniel Veillardbe076e92005-01-04 20:18:14 +0000159 "failed to close: %s\n", module->name);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000160 return -2;
161 }
162
163 rc = xmlModuleFree(module);
164 return (rc);
165}
166
167/**
168 * xmlModuleFree:
169 * @module: the module handle
170 *
171 * The free operations free the data associated to the module
172 * but does not unload the associated shared library which may still
173 * be in use.
174 *
175 * Returns 0 in case of success, -1 in case of argument error
176 */
177int
178xmlModuleFree(xmlModulePtr module)
179{
180 if (NULL == module) {
181 __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_MODULE,
Daniel Veillard24505b02005-07-28 23:49:35 +0000182 XML_MODULE_CLOSE, XML_ERR_FATAL, NULL, 0, NULL,
Daniel Veillardbe076e92005-01-04 20:18:14 +0000183 NULL, NULL, 0, 0, "null module pointer\n");
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000184 return -1;
185 }
186
187 xmlFree(module->name);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000188 xmlFree(module);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000189
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000190 return (0);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000191}
192
193#ifdef HAVE_DLOPEN
Daniel Veillarddcd93902005-01-13 11:25:15 +0000194#ifdef HAVE_DLFCN_H
Daniel Veillardce1648b2005-01-04 15:10:22 +0000195#include <dlfcn.h>
Daniel Veillarddcd93902005-01-13 11:25:15 +0000196#endif
Daniel Veillardce1648b2005-01-04 15:10:22 +0000197
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000198/**
Daniel Veillardce1648b2005-01-04 15:10:22 +0000199 * xmlModulePlatformOpen:
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000200 * @name: path to the module
201 *
Daniel Veillardce1648b2005-01-04 15:10:22 +0000202 * returns a handle on success, and zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000203 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000204
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000205static void *
206xmlModulePlatformOpen(const char *name)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000207{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000208 return dlopen(name, RTLD_GLOBAL | RTLD_NOW);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000209}
210
211/*
212 * xmlModulePlatformClose:
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000213 * @handle: handle to the module
214 *
Daniel Veillardce1648b2005-01-04 15:10:22 +0000215 * returns 0 on success, and non-zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000216 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000217
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000218static int
219xmlModulePlatformClose(void *handle)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000220{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000221 return dlclose(handle);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000222}
223
224/*
225 * xmlModulePlatformSymbol:
Daniel Veillardbe076e92005-01-04 20:18:14 +0000226 * http://www.opengroup.org/onlinepubs/009695399/functions/dlsym.html
227 * returns 0 on success and the loaded symbol in result, and -1 on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000228 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000229
Daniel Veillardbe076e92005-01-04 20:18:14 +0000230static int
231xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000232{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000233 *symbol = dlsym(handle, name);
234 if (dlerror() != NULL) {
235 return -1;
236 }
237 return 0;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000238}
239
Daniel Veillardff4c1852005-03-10 10:37:28 +0000240#else /* ! HAVE_DLOPEN */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000241
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000242#ifdef HAVE_SHLLOAD /* HAVE_SHLLOAD */
Daniel Veillarddcd93902005-01-13 11:25:15 +0000243#ifdef HAVE_DL_H
244#include <dl.h>
245#endif
Daniel Veillardce1648b2005-01-04 15:10:22 +0000246/*
247 * xmlModulePlatformOpen:
248 * returns a handle on success, and zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000249 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000250
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000251static void *
252xmlModulePlatformOpen(const char *name)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000253{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000254 return shl_load(name, BIND_IMMEDIATE, 0L);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000255}
256
257/*
258 * xmlModulePlatformClose:
259 * returns 0 on success, and non-zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000260 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000261
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000262static int
263xmlModulePlatformClose(void *handle)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000264{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000265 return shl_unload(handle);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000266}
267
268/*
269 * xmlModulePlatformSymbol:
Daniel Veillardbe076e92005-01-04 20:18:14 +0000270 * http://docs.hp.com/en/B2355-90683/shl_load.3X.html
271 * returns 0 on success and the loaded symbol in result, and -1 on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000272 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000273
Daniel Veillardbe076e92005-01-04 20:18:14 +0000274static int
275xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000276{
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000277 int rc;
278
279 errno = 0;
Daniel Veillardbe076e92005-01-04 20:18:14 +0000280 rc = shl_findsym(handle, name, TYPE_PROCEDURE, symbol);
281 if ((-1 == rc) && (0 == errno)) {
282 rc = shl_findsym(handle, name, TYPE_DATA, symbol);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000283 }
Daniel Veillardbe076e92005-01-04 20:18:14 +0000284 return rc;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000285}
286
287#endif /* HAVE_SHLLOAD */
Daniel Veillardff4c1852005-03-10 10:37:28 +0000288#endif /* ! HAVE_DLOPEN */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000289
290#ifdef _WIN32
291
292#include <windows.h>
293
294/*
295 * xmlModulePlatformOpen:
296 * returns a handle on success, and zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000297 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000298
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000299static void *
300xmlModulePlatformOpen(const char *name)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000301{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000302 return LoadLibrary(name);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000303}
304
305/*
306 * xmlModulePlatformClose:
307 * returns 0 on success, and non-zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000308 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000309
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000310static int
311xmlModulePlatformClose(void *handle)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000312{
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000313 int rc;
314
315 rc = FreeLibrary(handle);
316 return (0 == rc);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000317}
318
319/*
320 * xmlModulePlatformSymbol:
Daniel Veillardbe076e92005-01-04 20:18:14 +0000321 * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getprocaddress.asp
322 * returns 0 on success and the loaded symbol in result, and -1 on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000323 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000324
Daniel Veillardbe076e92005-01-04 20:18:14 +0000325static int
326xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000327{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000328 *symbol = GetProcAddress(handle, name);
329 return (NULL == *symbol) ? -1 : 0;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000330}
331
332#endif /* _WIN32 */
333
334#ifdef HAVE_BEOS
335
336#include <kernel/image.h>
337
338/*
339 * xmlModulePlatformOpen:
340 * beos api info: http://www.beunited.org/bebook/The%20Kernel%20Kit/Images.html
341 * returns a handle on success, and zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000342 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000343
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000344static void *
345xmlModulePlatformOpen(const char *name)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000346{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000347 return (void *) load_add_on(name);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000348}
349
350/*
351 * xmlModulePlatformClose:
352 * beos api info: http://www.beunited.org/bebook/The%20Kernel%20Kit/Images.html
353 * returns 0 on success, and non-zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000354 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000355
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000356static int
357xmlModulePlatformClose(void *handle)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000358{
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000359 status_t rc;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000360
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000361 rc = unload_add_on((image_id) handle);
362
363 if (rc == B_OK)
364 return 0;
365 else
366 return -1;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000367}
368
369/*
370 * xmlModulePlatformSymbol:
371 * beos api info: http://www.beunited.org/bebook/The%20Kernel%20Kit/Images.html
Daniel Veillardbe076e92005-01-04 20:18:14 +0000372 * returns 0 on success and the loaded symbol in result, and -1 on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000373 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000374
Daniel Veillardbe076e92005-01-04 20:18:14 +0000375static int
376xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000377{
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000378 status_t rc;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000379
Daniel Veillardbe076e92005-01-04 20:18:14 +0000380 rc = get_image_symbol((image_id) handle, name, B_SYMBOL_TYPE_ANY, symbol);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000381
Daniel Veillardbe076e92005-01-04 20:18:14 +0000382 return (rc == B_OK) ? 0 : -1;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000383}
384
385#endif /* HAVE_BEOS */
386
387#ifdef HAVE_OS2
388
389#include <os2.h>
390
391/*
392 * xmlModulePlatformOpen:
393 * os2 api info: http://www.edm2.com/os2api/Dos/DosLoadModule.html
394 * returns a handle on success, and zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000395 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000396
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000397static void *
398xmlModulePlatformOpen(const char *name)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000399{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000400 char errbuf[256];
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000401 void *handle;
402 int rc;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000403
Daniel Veillardbe076e92005-01-04 20:18:14 +0000404 rc = DosLoadModule(errbuf, sizeof(errbuf) - 1, name, &handle);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000405
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000406 if (rc)
407 return 0;
408 else
409 return (handle);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000410}
411
412/*
413 * xmlModulePlatformClose:
414 * os2 api info: http://www.edm2.com/os2api/Dos/DosFreeModule.html
415 * returns 0 on success, and non-zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000416 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000417
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000418static int
419xmlModulePlatformClose(void *handle)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000420{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000421 return DosFreeModule(handle);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000422}
423
424/*
425 * xmlModulePlatformSymbol:
426 * os2 api info: http://www.edm2.com/os2api/Dos/DosQueryProcAddr.html
Daniel Veillardbe076e92005-01-04 20:18:14 +0000427 * returns 0 on success and the loaded symbol in result, and -1 on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000428 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000429
Daniel Veillardbe076e92005-01-04 20:18:14 +0000430static int
431xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000432{
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000433 int rc;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000434
Daniel Veillardbe076e92005-01-04 20:18:14 +0000435 rc = DosQueryProcAddr(handle, 0, name, symbol);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000436
Daniel Veillardbe076e92005-01-04 20:18:14 +0000437 return (rc == NO_ERROR) ? 0 : -1;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000438}
439
440#endif /* HAVE_OS2 */
441
Daniel Veillard5d4644e2005-04-01 13:11:58 +0000442#define bottom_xmlmodule
443#include "elfgcchack.h"
Daniel Veillardce1648b2005-01-04 15:10:22 +0000444#endif /* LIBXML_MODULES_ENABLED */