From: Andy Polyakov Date: Thu, 7 Apr 2005 16:06:03 +0000 (+0000) Subject: Engage DllMain on Windows. Partial backport from HEAD. Unlike HEAD, X-Git-Tag: OpenSSL_0_9_7g~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d2b407ba299726d9dc1b264642ba62e0a644b5c;p=openssl Engage DllMain on Windows. Partial backport from HEAD. Unlike HEAD, it doesn't get engaged on __CYGWIN__, because I'm not sure is *all* Cygwin installations are equipped with windows.h... --- diff --git a/Configure b/Configure index 3b7bcb5d83..e0e732c445 100755 --- a/Configure +++ b/Configure @@ -530,14 +530,14 @@ my %table=( "BC-16","bcc:::(unknown):WIN16::BN_LLONG DES_PTR RC4_INDEX SIXTEEN_BIT:::", # MinGW -"mingw", "gcc:-DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -mno-cygwin -Wall:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:win32:cygwin-shared:-D_DLL:-mno-cygwin:.dll", +"mingw", "gcc:-DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -mno-cygwin -Wall:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:win32:cygwin-shared:-D_WINDLL:-mno-cygwin:.dll", # UWIN "UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::win32", # Cygwin "Cygwin-pre1.3", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::win32", -"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:dlfcn:cygwin-shared:::.dll", +"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:dlfcn:cygwin-shared:-D_WINDLL::.dll", # DJGPP "DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall -DDEVRANDOM=\"/dev/urandom\\x24\":::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::", diff --git a/TABLE b/TABLE index eb5600203d..530fb011be 100644 --- a/TABLE +++ b/TABLE @@ -94,7 +94,7 @@ $rmd160_obj = asm/rm86-out.o $rc5_obj = asm/r586-out.o $dso_scheme = dlfcn $shared_target= cygwin-shared -$shared_cflag = +$shared_cflag = -D_WINDLL $shared_ldflag = $shared_extension = .dll $ranlib = @@ -3569,7 +3569,7 @@ $rmd160_obj = asm/rm86-out.o $rc5_obj = asm/r586-out.o $dso_scheme = win32 $shared_target= cygwin-shared -$shared_cflag = -D_DLL +$shared_cflag = -D_WINDLL $shared_ldflag = -mno-cygwin $shared_extension = .dll $ranlib = diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index b8e700ce52..fef0afb29f 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -480,13 +480,12 @@ const char *CRYPTO_get_lock_name(int type) return(sk_value(app_locks,type-CRYPTO_NUM_LOCKS)); } -#ifdef _DLL -#ifdef OPENSSL_SYS_WIN32 +#if defined(_WIN32) && defined(_WINDLL) /* All we really need to do is remove the 'error' state when a thread * detaches */ -BOOL WINAPI DLLEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch(fdwReason) @@ -505,8 +504,6 @@ BOOL WINAPI DLLEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, } #endif -#endif - void OpenSSLDie(const char *file,int line,const char *assertion) { fprintf(stderr,