2 * MSCMS - Color Management System for Wine
4 * Copyright 2004, 2005 Hans Leidekker
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "wine/port.h"
24 #include "wine/debug.h"
25 #include "wine/library.h"
35 #define LCMS_API_NO_REDEFINE
36 #define LCMS_API_FUNCTION(f) typeof(f) * p##f;
38 #undef LCMS_API_FUNCTION
40 WINE_DEFAULT_DEBUG_CHANNEL(mscms);
43 #ifndef SONAME_LIBLCMS
44 #define SONAME_LIBLCMS "liblcms.so"
47 static void *lcmshandle = NULL;
48 #endif /* HAVE_LCMS_H */
50 static BOOL MSCMS_init_lcms(void)
53 /* dynamically load lcms if not yet loaded */
56 lcmshandle = wine_dlopen( SONAME_LIBLCMS, RTLD_NOW, NULL, 0 );
58 /* We can't really do anything useful without liblcms */
62 "Wine cannot find the LittleCMS library. To enable Wine to use color\n"
63 "management functions please install a version of LittleCMS greater\n"
64 "than or equal to 1.13.\n"
65 "http://www.littlecms.com\n" );
71 #define LOAD_FUNCPTR(f) \
72 if ((p##f = wine_dlsym( lcmshandle, #f, NULL, 0 )) == NULL) \
75 LOAD_FUNCPTR(cmsCloseProfile);
76 LOAD_FUNCPTR(cmsCreate_sRGBProfile);
77 LOAD_FUNCPTR(cmsCreateMultiprofileTransform);
78 LOAD_FUNCPTR(cmsCreateTransform);
79 LOAD_FUNCPTR(cmsDeleteTransform);
80 LOAD_FUNCPTR(cmsDoTransform);
81 LOAD_FUNCPTR(cmsOpenProfileFromMem);
88 "Wine cannot find certain functions that it needs inside the LittleCMS\n"
89 "library. To enable Wine to use LittleCMS for color management please\n"
90 "upgrade liblcms to at least version 1.13.\n"
91 "http://www.littlecms.com\n" );
93 wine_dlclose( lcmshandle, NULL, 0 );
98 #endif /* HAVE_LCMS_H */
100 "This version of Wine was compiled without support for color management\n"
101 "functions. To enable Wine to use LittleCMS for color management please\n"
102 "install a liblcms development package version 1.13 or higher and rebuild\n"
104 "http://www.littlecms.com\n" );
109 static void MSCMS_deinit_lcms(void)
114 wine_dlclose( lcmshandle, NULL, 0 );
117 #endif /* HAVE_LCMS_H */
120 BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
122 TRACE( "(%p, 0x%08lx, %p)\n", hinst, reason, reserved );
126 case DLL_PROCESS_ATTACH:
127 DisableThreadLibraryCalls( hinst );
128 return MSCMS_init_lcms();
130 case DLL_PROCESS_DETACH: