Re: [xml] Creating Win32 wrapper function for exported variables



You can export variables if you use a .def file for the .dll.

There's no need for wrapper functions.

Rob

----- Original Message -----
From: "Vakoc, Mark" <Mark_Vakoc jdedwards com>
To: <xml gnome org>
Sent: Wednesday, July 18, 2001 2:19 AM
Subject: [xml] Creating Win32 wrapper function for exported variables



In Win32 you can import only functions from a library (.DLL) and not
variables.  This causes problems if libxml2 is built as a dll, and a
program
attempts to use an exported variable.  It will compile/link, but will fail
at runtime.

I propose creating simple wrappers for global parsing variables.  A good
example program is xsltproc, which has a line

if (novalid == 0)
  xmlLoadExtDtdDefaultValue = 6;
else
  xmlLoadExtDtdDefaultValue = 0;

If xsltproc is linked against libxml2 as a .DLL (not as a .lib), this will
cause a segv.

I created a wrapper function in parserInternals so the code now looks like

if (novalid == 0)
  xmlSetLoadExtDtdDefaultValue(6);
else
  xmlSetLoadExtDtdDefaultValue(0);

Extremely simple, but saves us win32 programmers some troubles. (I also
have
a xmlGetLoadExtDtdDefaultValue wrapper).

What do you think?

_______________________________________________
xml mailing list
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]