widl: Include the version number in the __WIDL__ preprocessor definition.
[wine/multimedia.git] / dlls / msxml3 / main.c
blob358a5cb3af1e4d46abaa055df0a8ba22e17277f4
1 /*
2 * MSXML Class Factory
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
22 #include "config.h"
23 #include "wine/port.h"
25 #define COBJMACROS
27 #include <stdarg.h>
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winuser.h"
31 #include "ole2.h"
32 #include "msxml.h"
33 #include "msxml2.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)
44 FIXME("\n");
45 return S_FALSE;
49 void* libxslt_handle = NULL;
50 #ifdef SONAME_LIBXSLT
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);
56 # undef MAKE_FUNCPTR
57 #endif
59 static void init_libxslt(void)
61 #ifdef SONAME_LIBXSLT
62 void (*pxsltInit)(void); /* Missing in libxslt <= 1.1.14 */
64 libxslt_handle = wine_dlopen(SONAME_LIBXSLT, RTLD_NOW, NULL, 0);
65 if (!libxslt_handle)
66 return;
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);
74 #undef LOAD_FUNCPTR
76 if (pxsltInit)
77 pxsltInit();
78 return;
80 sym_not_found:
81 wine_dlclose(libxslt_handle, NULL, 0);
82 libxslt_handle = NULL;
83 #endif
87 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
89 switch(fdwReason)
91 case DLL_PROCESS_ATTACH:
92 #ifdef HAVE_LIBXML2
93 xmlInitParser();
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");
99 #endif
100 init_libxslt();
101 DisableThreadLibraryCalls(hInstDLL);
102 break;
103 case DLL_PROCESS_DETACH:
104 #ifdef SONAME_LIBXSLT
105 if (libxslt_handle)
107 pxsltCleanupGlobals();
108 wine_dlclose(libxslt_handle, NULL, 0);
109 libxslt_handle = NULL;
111 #endif
112 #ifdef HAVE_LIBXML2
113 xmlCleanupParser();
114 #endif
115 release_typelib();
116 break;
118 return TRUE;