4 * Copyright 2002 Lionel Ulmer
5 * Copyright 2005 Mike McCormack
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "wine/port.h"
35 #include "wine/debug.h"
36 #include "wine/library.h"
38 #include "msxml_private.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
42 HRESULT WINAPI DllCanUnloadNow(void)
49 void* libxslt_handle = NULL;
51 # define DECL_FUNCPTR(f) typeof(f) * p##f = NULL
52 DECL_FUNCPTR(xsltApplyStylesheet);
53 DECL_FUNCPTR(xsltCleanupGlobals);
54 DECL_FUNCPTR(xsltFreeStylesheet);
55 DECL_FUNCPTR(xsltParseStylesheetDoc);
59 static void init_libxslt(void)
62 void (*pxsltInit)(void); /* Missing in libxslt <= 1.1.14 */
64 libxslt_handle = wine_dlopen(SONAME_LIBXSLT, RTLD_NOW, NULL, 0);
68 #define LOAD_FUNCPTR(f, needed) if ((p##f = wine_dlsym(libxslt_handle, #f, NULL, 0)) == NULL && needed) { WARN("Can't find symbol %s\n", #f); goto sym_not_found; }
69 LOAD_FUNCPTR(xsltInit, 0);
70 LOAD_FUNCPTR(xsltApplyStylesheet, 1);
71 LOAD_FUNCPTR(xsltCleanupGlobals, 1);
72 LOAD_FUNCPTR(xsltFreeStylesheet, 1);
73 LOAD_FUNCPTR(xsltParseStylesheetDoc, 1);
81 wine_dlclose(libxslt_handle, NULL, 0);
82 libxslt_handle = NULL;
87 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
91 case DLL_PROCESS_ATTACH:
95 /* Set the default indent character to a single tab,
96 for this thread and as default for new threads */
97 xmlTreeIndentString = "\t";
98 xmlThrDefTreeIndentString("\t");
101 DisableThreadLibraryCalls(hInstDLL);
103 case DLL_PROCESS_DETACH:
104 #ifdef SONAME_LIBXSLT
107 pxsltCleanupGlobals();
108 wine_dlclose(libxslt_handle, NULL, 0);
109 libxslt_handle = NULL;