msxml3: Determine whether to call xsltInit() or not at run time.

Francois Gouget fgouget at codeweavers.com
Mon Nov 17 08:09:20 CST 2008


---

configure will need to be regenerated. I did not include it here since  
the consensus seems to be that it should not be included.

This should fix bug 13035.
http://bugs.winehq.org/show_bug.cgi?id=13035

As a reminder, the issue is that it's not because the libxslt.so we
compile against has xlstInit() that the one we load at runtime will have
it too. And vice versa.


 configure.ac        |    5 +----
 dlls/msxml3/main.c  |   17 ++++++++++++++---
 include/config.h.in |    6 +++---
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index 71c2a45..b17a9a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -885,10 +885,7 @@ then
             [AC_DEFINE(HAVE_LIBXSLT, 1, [Define if you have the libxslt library])
              XSLTLIBS="$ac_xslt_libs"
              XSLTINCL="$ac_xslt_cflags"
-             ac_save_LIBS="$LIBS"
-             LIBS="$LIBS $ac_xslt_libs"
-             AC_CHECK_FUNCS(xsltInit)
-             LIBS="$ac_save_LIBS"],,$ac_xslt_libs)
+             WINE_CHECK_SONAME(xslt,xsltCompilePattern,,,[$ac_xslt_libs])],,$ac_xslt_libs)
     fi
 fi
 WINE_WARNING_WITH(xslt,[test "$ac_cv_lib_xslt_xsltCompilePattern" != "yes"],
diff --git a/dlls/msxml3/main.c b/dlls/msxml3/main.c
index 8dbacbf..131be97 100644
--- a/dlls/msxml3/main.c
+++ b/dlls/msxml3/main.c
@@ -20,6 +20,7 @@
  */
 
 #include "config.h"
+#include "wine/port.h"
 
 #define COBJMACROS
 
@@ -32,6 +33,7 @@
 #include "msxml2.h"
 
 #include "wine/debug.h"
+#include "wine/library.h"
 
 #include "msxml_private.h"
 
@@ -49,6 +51,9 @@ HRESULT WINAPI DllCanUnloadNow(void)
 
 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
 {
+    void* xslt_handle;
+    void (*p_xsltInit)(void);
+
     switch(fdwReason)
     {
     case DLL_PROCESS_ATTACH:
@@ -60,9 +65,15 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
         xmlTreeIndentString = "\t";
         xmlThrDefTreeIndentString("\t");
 #endif
-#ifdef HAVE_XSLTINIT
-        xsltInit();
-#endif
+
+        xslt_handle = wine_dlopen(SONAME_LIBXSLT, RTLD_NOW, NULL, 0);
+        if (xslt_handle)
+        {
+            p_xsltInit = wine_dlsym(xslt_handle, "xsltInit", NULL, 0);
+            if (p_xsltInit)
+                p_xsltInit();
+            wine_dlclose(xslt_handle, NULL, 0);
+        }
         DisableThreadLibraryCalls(hInstDLL);
         break;
     case DLL_PROCESS_DETACH:
diff --git a/include/config.h.in b/include/config.h.in
index 016ee8e..234e177 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -1002,9 +1002,6 @@
 /* Define if Xrender has the XRenderSetPictureTransform function */
 #undef HAVE_XRENDERSETPICTURETRANSFORM
 
-/* Define to 1 if you have the `xsltInit' function. */
-#undef HAVE_XSLTINIT
-
 /* Define to 1 if you have the `_pclose' function. */
 #undef HAVE__PCLOSE
 
@@ -1128,6 +1125,9 @@
 /* Define to the soname of the libXrender library. */
 #undef SONAME_LIBXRENDER
 
+/* Define to the soname of the libxslt library. */
+#undef SONAME_LIBXSLT
+
 /* Define to the soname of the libXxf86vm library. */
 #undef SONAME_LIBXXF86VM
 
-- 
1.5.6.5



More information about the wine-patches mailing list