From 5b52f5fac7ea562cdec59bb5b7156cc09a40186a Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 25 Apr 2006 17:20:53 +0000 Subject: [PATCH] Windows DLLs no longer version-mangled svn: r2777 --- collects/openssl/mzssl.ss | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/collects/openssl/mzssl.ss b/collects/openssl/mzssl.ss index b90b8d6f4d..3b88718bfb 100644 --- a/collects/openssl/mzssl.ss +++ b/collects/openssl/mzssl.ss @@ -56,15 +56,25 @@ (lambda () (let ([m (regexp-match #rx#"dLl dIRECTORy:([^\0]*)\0" (current-input-port))]) (unless m (error "cannot find DLL directory")) - (let-values ([(dir name dir?) (split-path exe)]) - (build-path dir (bytes->path (cadr m)))))))))) + (if (regexp-match #rx#"^<" (cadr m)) + #f ; no lib dir + (let-values ([(dir name dir?) (split-path exe)]) + (build-path dir (bytes->path (cadr m))))))))))) + + (define (ffi-lib-win name) + (let* ([d (force windows-lib-dir)] + [f (and d (build-path d (format "~a.dll" name)))]) + ;; Try PLT-specific lib: + (if (and f (file-exists? f)) + (ffi-lib f) + ;; Try system-wide: + (ffi-lib (format "~a.dll" name))))) (define (ffi-lib-xxxxxxx name) - (let* ([d (force windows-lib-dir)] - [f (build-path d (format "~a~a.dll" name filename-version-part))]) - (if (file-exists? f) - (ffi-lib f) - (ffi-lib (build-path d (format "~axxxxxxx.dll" name)))))) + (let* ([f (format "~a~a" name filename-version-part)]) + (or (with-handlers ([exn? (lambda (x) #f)]) + (ffi-lib-win (format "~a~a" name filename-version-part))) + (ffi-lib-win (format "~axxxxxxx" name))))) (define 3m? (regexp-match #rx#"3m" (path->bytes (system-library-subpath)))) @@ -74,7 +84,7 @@ #f)]) (case (system-type) [(windows) - (ffi-lib-xxxxxxx "libeay32")] + (ffi-lib-win "libeay32")] [else (ffi-lib "libssl")]))) @@ -85,7 +95,7 @@ (case (system-type) [(windows) (and libeay - (ffi-lib-xxxxxxx "ssleay32"))] + (ffi-lib-win "ssleay32"))] [else libeay])))