[xmlsec] don't use ltdl on windows
- From: Aleksey Sanin <aleksey src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [xmlsec] don't use ltdl on windows
- Date: Sat, 7 Nov 2009 00:31:14 +0000 (UTC)
commit 102f4cfef5b4b095fafff9cc6f05b5257767f07f
Author: Aleksey Sanin <aleksey aleksey com>
Date: Fri Nov 6 16:31:07 2009 -0800
don't use ltdl on windows
src/dl.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++--
win32/Makefile.msvc | 7 +------
win32/mycfg.bat | 14 +++++++-------
3 files changed, 57 insertions(+), 15 deletions(-)
---
diff --git a/src/dl.c b/src/dl.c
index cf267d7..249218c 100644
--- a/src/dl.c
+++ b/src/dl.c
@@ -36,6 +36,9 @@
#include <ltdl.h>
#endif /* XMLSEC_DL_LIBLTDL */
+#ifdef XMLSEC_DL_WIN32
+#include <windows.h>
+#endif /* XMLSEC_DL_WIN32 */
/***********************************************************************
*
@@ -53,6 +56,10 @@ struct _xmlSecCryptoDLLibrary {
#ifdef XMLSEC_DL_LIBLTDL
lt_dlhandle handle;
#endif /* XMLSEC_DL_LIBLTDL */
+
+#ifdef XMLSEC_DL_WIN32
+ HINSTANCE handle;
+#endif /* XMLSEC_DL_WIN32 */
};
static xmlSecCryptoDLLibraryPtr xmlSecCryptoDLLibraryCreate (const xmlChar* name);
@@ -155,6 +162,32 @@ xmlSecCryptoDLLibraryCreate(const xmlChar* name) {
}
#endif /* XMLSEC_DL_LIBLTDL */
+#ifdef XMLSEC_DL_WIN32
+ lib->handle = LoadLibraryA((char*)lib->filename);
+ if(lib->handle == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "LoadLibraryA",
+ NULL,
+ XMLSEC_ERRORS_R_IO_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(lib->filename));
+ xmlSecCryptoDLLibraryDestroy(lib);
+ return(NULL);
+ }
+
+ getFunctions = (xmlSecCryptoGetFunctionsCallback)GetProcAddress(lib->handle, (char*)lib->getFunctionsName);
+ if(getFunctions == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "GetProcAddressA",
+ NULL,
+ XMLSEC_ERRORS_R_IO_FAILED,
+ "function=%s",
+ xmlSecErrorsSafeString(lib->getFunctionsName));
+ xmlSecCryptoDLLibraryDestroy(lib);
+ return(NULL);
+ }
+#endif /* XMLSEC_DL_WIN32 */
+
if(getFunctions == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
@@ -197,8 +230,8 @@ xmlSecCryptoDLLibraryDestroy(xmlSecCryptoDLLibraryPtr lib) {
xmlFree(lib->getFunctionsName);
}
- if(lib->handle != NULL) {
#ifdef XMLSEC_DL_LIBLTDL
+ if(lib->handle != NULL) {
int ret;
ret = lt_dlclose(lib->handle);
@@ -209,9 +242,23 @@ xmlSecCryptoDLLibraryDestroy(xmlSecCryptoDLLibraryPtr lib) {
XMLSEC_ERRORS_R_IO_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
}
+ }
#endif /* XMLSEC_DL_LIBLTDL */
- }
+#ifdef XMLSEC_DL_WIN32
+ if(lib->handle != NULL) {
+ BOOL res;
+
+ res = FreeLibrary(lib->handle);
+ if(!res) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "FreeLibrary",
+ NULL,
+ XMLSEC_ERRORS_R_IO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ }
+ }
+#endif /* XMLSEC_DL_WIN32*/
memset(lib, 0, sizeof(xmlSecCryptoDLLibrary));
xmlFree(lib);
diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc
index 9aff95b..362f41e 100644
--- a/win32/Makefile.msvc
+++ b/win32/Makefile.msvc
@@ -184,11 +184,6 @@ XMLSEC_OBJS_A = \
$(XMLSEC_INTDIR_A)\xpath.obj \
$(XMLSEC_INTDIR_A)\xslt.obj
-!if "$(WITH_DL)" == "1"
-XMLSEC_OBJS = $(XMLSEC_OBJS) $(XMLSEC_INTDIR)\xmlsec-ltdl.obj
-XMLSEC_OBJS_A = $(XMLSEC_OBJS_A) $(XMLSEC_INTDIR_A)\xmlsec-ltdl.obj
-!endif
-
XMLSEC_OPENSSL_OBJS = \
$(XMLSEC_OPENSSL_INTDIR)\app.obj\
$(XMLSEC_OPENSSL_INTDIR)\bn.obj \
@@ -323,7 +318,7 @@ CFLAGS = $(CFLAGS) /DXMLSEC_MSCRYPTO_NT4=1
APP_CFLAGS = /D "XMLSEC_CRYPTO=\"$(XMLSEC_CRYPTO)\""
!if "$(WITH_DL)" == "1"
-CFLAGS = $(CFLAGS) /D LTDL_OBJDIR=\"\" /D LTDL_SHLIB_EXT=\".dll\"
+CFLAGS = $(CFLAGS) /D "XMLSEC_DL_WIN32"
APP_CFLAGS = $(APP_CFLAGS) /D "XMLSEC_CRYPTO_DYNAMIC_LOADING"
!else
CFLAGS = $(CFLAGS) /D "XMLSEC_NO_CRYPTO_DYNAMIC_LOADING"
diff --git a/win32/mycfg.bat b/win32/mycfg.bat
index 3955791..bf75ff0 100644
--- a/win32/mycfg.bat
+++ b/win32/mycfg.bat
@@ -1,4 +1,4 @@
- echo off
+ echo on
REM
REM This is my personal configuration file.
REM I am lazy to type all this crap again and again
@@ -8,14 +8,14 @@ REM
REM Aleksey Sanin <aleksey aleksey com>
REM
-SET XMLSEC_PREFIX=d:\sdk
-SET XMLSEC_INCLUDE=%XMLSEC_PREFIX%\include;%XMLSEC_PREFIX%\include\mozilla;%XMLSEC_PREFIX%\include\mozilla\nspr;%XMLSEC_PREFIX%\include\mozilla\nss;%MSSDK_INCLUDE%
-SET XMLSEC_LIB=%XMLSEC_PREFIX%\lib;%MSSDK_LIB%
+SET PREFIX=C:\cygwin\home\local
+SET XMLSEC_INCLUDE=%PREFIX%\include;%PREFIX%\include\mozilla;%PREFIX%\include\mozilla\nspr;%PREFIX%\include\mozilla\nss;%MSSDK_INCLUDE%
+SET XMLSEC_LIB=%PREFIX%\lib;%MSSDK_LIB%
SET XMLSEC_OPTIONS=static=no iconv=no nt4=yes debug=yes xslt=yes crypto=openssl=098,mscrypto
del /F Makefile configure.txt
-cscript configure.js prefix=%XMLSEC_PREFIX% %XMLSEC_OPTIONS% include=%XMLSEC_INCLUDE% lib=%XMLSEC_LIB%
+cscript configure.js prefix=%PREFIX% %XMLSEC_OPTIONS% include=%XMLSEC_INCLUDE% lib=%XMLSEC_LIB%
mkdir binaries
-copy %XMLSEC_PREFIX%\bin\*.dll binaries
-copy %XMLSEC_PREFIX%\lib\*.dll binaries
+copy %PREFIX%\bin\*.dll binaries
+copy %PREFIX%\lib\*.dll binaries
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]