mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
applied DSO support patch 2 from Joel Reed Daniel
* Makefile.am config.h.in configure.in error.c libxml-2.0.pc.in testModule.c testdso.c xml2-config.in xmllint.c xmlmodule.c include/libxml/Makefile.am include/libxml/xmlerror.h include/libxml/xmlmodule.h include/libxml/xmlversion.h.in include/libxml/xmlwin32version.h.in: applied DSO support patch 2 from Joel Reed Daniel
This commit is contained in:
60
testModule.c
Normal file
60
testModule.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* testModule.c : a small tester program for xmlModule
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* joelwreed@comcast.net
|
||||
*/
|
||||
|
||||
#include "libxml.h"
|
||||
#ifdef LIBXML_MODULES_ENABLED
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/debugXML.h>
|
||||
#include <libxml/xmlmodule.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define MODULE_PATH "."
|
||||
#include <stdlib.h> /* for _MAX_PATH */
|
||||
#define PATH_MAX _MAX_PATH
|
||||
#else
|
||||
#define MODULE_PATH ".libs"
|
||||
#endif
|
||||
|
||||
typedef int (*hello_world_t)();
|
||||
|
||||
int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
||||
xmlChar filename[PATH_MAX];
|
||||
xmlModulePtr module = NULL;
|
||||
hello_world_t hello_world = NULL;
|
||||
|
||||
/* build the module filename, and confirm the module exists */
|
||||
xmlStrPrintf(filename, sizeof(filename), "%s/testdso%s", (const xmlChar*)MODULE_PATH, (const xmlChar*)LIBXML_MODULE_EXTENSION);
|
||||
|
||||
module = xmlModuleOpen((const char*)filename);
|
||||
if (module)
|
||||
{
|
||||
hello_world = (hello_world_t)xmlModuleSymbol(module, "hello_world");
|
||||
(*hello_world)();
|
||||
|
||||
xmlModuleClose(module);
|
||||
}
|
||||
|
||||
xmlMemoryDump();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
#else
|
||||
#include <stdio.h>
|
||||
int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
||||
printf("%s : Module support not compiled in\n", argv[0]);
|
||||
return(0);
|
||||
}
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
Reference in New Issue
Block a user