blob: 15bcf077c04ce897ea886351178ff5867dbf58d9 [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 Veillard9b693b42005-10-28 14:54:17 +0000198#ifndef RTLD_GLOBAL /* For Tru64 UNIX 4.0 */
199#define RTLD_GLOBAL 0
200#endif
201
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000202/**
Daniel Veillardce1648b2005-01-04 15:10:22 +0000203 * xmlModulePlatformOpen:
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000204 * @name: path to the module
205 *
Daniel Veillardce1648b2005-01-04 15:10:22 +0000206 * returns a handle on success, and zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000207 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000208
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000209static void *
210xmlModulePlatformOpen(const char *name)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000211{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000212 return dlopen(name, RTLD_GLOBAL | RTLD_NOW);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000213}
214
215/*
216 * xmlModulePlatformClose:
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000217 * @handle: handle to the module
218 *
Daniel Veillardce1648b2005-01-04 15:10:22 +0000219 * returns 0 on success, and non-zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000220 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000221
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000222static int
223xmlModulePlatformClose(void *handle)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000224{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000225 return dlclose(handle);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000226}
227
228/*
229 * xmlModulePlatformSymbol:
Daniel Veillardbe076e92005-01-04 20:18:14 +0000230 * http://www.opengroup.org/onlinepubs/009695399/functions/dlsym.html
231 * returns 0 on success and the loaded symbol in result, and -1 on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000232 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000233
Daniel Veillardbe076e92005-01-04 20:18:14 +0000234static int
235xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000236{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000237 *symbol = dlsym(handle, name);
238 if (dlerror() != NULL) {
239 return -1;
240 }
241 return 0;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000242}
243
Daniel Veillardff4c1852005-03-10 10:37:28 +0000244#else /* ! HAVE_DLOPEN */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000245
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000246#ifdef HAVE_SHLLOAD /* HAVE_SHLLOAD */
Daniel Veillarddcd93902005-01-13 11:25:15 +0000247#ifdef HAVE_DL_H
248#include <dl.h>
249#endif
Daniel Veillardce1648b2005-01-04 15:10:22 +0000250/*
251 * xmlModulePlatformOpen:
252 * returns a handle on success, and zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000253 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000254
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000255static void *
256xmlModulePlatformOpen(const char *name)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000257{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000258 return shl_load(name, BIND_IMMEDIATE, 0L);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000259}
260
261/*
262 * xmlModulePlatformClose:
263 * returns 0 on success, and non-zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000264 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000265
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000266static int
267xmlModulePlatformClose(void *handle)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000268{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000269 return shl_unload(handle);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000270}
271
272/*
273 * xmlModulePlatformSymbol:
Daniel Veillardbe076e92005-01-04 20:18:14 +0000274 * http://docs.hp.com/en/B2355-90683/shl_load.3X.html
275 * returns 0 on success and the loaded symbol in result, and -1 on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000276 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000277
Daniel Veillardbe076e92005-01-04 20:18:14 +0000278static int
279xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000280{
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000281 int rc;
282
283 errno = 0;
Daniel Veillard9b693b42005-10-28 14:54:17 +0000284 rc = shl_findsym(&handle, name, TYPE_UNDEFINED, symbol);
Daniel Veillardbe076e92005-01-04 20:18:14 +0000285 return rc;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000286}
287
288#endif /* HAVE_SHLLOAD */
Daniel Veillardff4c1852005-03-10 10:37:28 +0000289#endif /* ! HAVE_DLOPEN */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000290
291#ifdef _WIN32
292
293#include <windows.h>
294
295/*
296 * xmlModulePlatformOpen:
297 * returns a handle on success, and zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000298 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000299
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000300static void *
301xmlModulePlatformOpen(const char *name)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000302{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000303 return LoadLibrary(name);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000304}
305
306/*
307 * xmlModulePlatformClose:
308 * returns 0 on success, and non-zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000309 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000310
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000311static int
312xmlModulePlatformClose(void *handle)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000313{
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000314 int rc;
315
316 rc = FreeLibrary(handle);
317 return (0 == rc);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000318}
319
320/*
321 * xmlModulePlatformSymbol:
Daniel Veillardbe076e92005-01-04 20:18:14 +0000322 * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getprocaddress.asp
323 * returns 0 on success and the loaded symbol in result, and -1 on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000324 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000325
Daniel Veillardbe076e92005-01-04 20:18:14 +0000326static int
327xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000328{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000329 *symbol = GetProcAddress(handle, name);
330 return (NULL == *symbol) ? -1 : 0;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000331}
332
333#endif /* _WIN32 */
334
335#ifdef HAVE_BEOS
336
337#include <kernel/image.h>
338
339/*
340 * xmlModulePlatformOpen:
341 * beos api info: http://www.beunited.org/bebook/The%20Kernel%20Kit/Images.html
342 * returns a handle on success, and zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000343 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000344
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000345static void *
346xmlModulePlatformOpen(const char *name)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000347{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000348 return (void *) load_add_on(name);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000349}
350
351/*
352 * xmlModulePlatformClose:
353 * beos api info: http://www.beunited.org/bebook/The%20Kernel%20Kit/Images.html
354 * returns 0 on success, and non-zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000355 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000356
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000357static int
358xmlModulePlatformClose(void *handle)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000359{
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000360 status_t rc;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000361
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000362 rc = unload_add_on((image_id) handle);
363
364 if (rc == B_OK)
365 return 0;
366 else
367 return -1;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000368}
369
370/*
371 * xmlModulePlatformSymbol:
372 * beos api info: http://www.beunited.org/bebook/The%20Kernel%20Kit/Images.html
Daniel Veillardbe076e92005-01-04 20:18:14 +0000373 * returns 0 on success and the loaded symbol in result, and -1 on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000374 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000375
Daniel Veillardbe076e92005-01-04 20:18:14 +0000376static int
377xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000378{
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000379 status_t rc;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000380
Daniel Veillardbe076e92005-01-04 20:18:14 +0000381 rc = get_image_symbol((image_id) handle, name, B_SYMBOL_TYPE_ANY, symbol);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000382
Daniel Veillardbe076e92005-01-04 20:18:14 +0000383 return (rc == B_OK) ? 0 : -1;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000384}
385
386#endif /* HAVE_BEOS */
387
388#ifdef HAVE_OS2
389
390#include <os2.h>
391
392/*
393 * xmlModulePlatformOpen:
394 * os2 api info: http://www.edm2.com/os2api/Dos/DosLoadModule.html
395 * returns a handle on success, and zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000396 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000397
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000398static void *
399xmlModulePlatformOpen(const char *name)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000400{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000401 char errbuf[256];
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000402 void *handle;
403 int rc;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000404
Daniel Veillardbe076e92005-01-04 20:18:14 +0000405 rc = DosLoadModule(errbuf, sizeof(errbuf) - 1, name, &handle);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000406
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000407 if (rc)
408 return 0;
409 else
410 return (handle);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000411}
412
413/*
414 * xmlModulePlatformClose:
415 * os2 api info: http://www.edm2.com/os2api/Dos/DosFreeModule.html
416 * returns 0 on success, and non-zero on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000417 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000418
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000419static int
420xmlModulePlatformClose(void *handle)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000421{
Daniel Veillardbe076e92005-01-04 20:18:14 +0000422 return DosFreeModule(handle);
Daniel Veillardce1648b2005-01-04 15:10:22 +0000423}
424
425/*
426 * xmlModulePlatformSymbol:
427 * os2 api info: http://www.edm2.com/os2api/Dos/DosQueryProcAddr.html
Daniel Veillardbe076e92005-01-04 20:18:14 +0000428 * returns 0 on success and the loaded symbol in result, and -1 on error.
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000429 */
Daniel Veillardce1648b2005-01-04 15:10:22 +0000430
Daniel Veillardbe076e92005-01-04 20:18:14 +0000431static int
432xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
Daniel Veillardce1648b2005-01-04 15:10:22 +0000433{
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000434 int rc;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000435
Daniel Veillardbe076e92005-01-04 20:18:14 +0000436 rc = DosQueryProcAddr(handle, 0, name, symbol);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000437
Daniel Veillardbe076e92005-01-04 20:18:14 +0000438 return (rc == NO_ERROR) ? 0 : -1;
Daniel Veillardce1648b2005-01-04 15:10:22 +0000439}
440
441#endif /* HAVE_OS2 */
442
Daniel Veillard5d4644e2005-04-01 13:11:58 +0000443#define bottom_xmlmodule
444#include "elfgcchack.h"
Daniel Veillardce1648b2005-01-04 15:10:22 +0000445#endif /* LIBXML_MODULES_ENABLED */