From dadc36252c2b4012f13cb81860148d795108377c Mon Sep 17 00:00:00 2001
From: Nikodemus Siivola <nikodemus@random-state.net>
Date: Sat, 17 Jan 2009 10:56:47 +0000
Subject: [PATCH] 1.0.24.46: SB-BSD-SOCKETS workingness from saved cores on
 Windows

 * Need to call WSA-STARTUP on init.

 * Reported by Stephen Westfold, fix by Rudi Schlatte.
---
 NEWS                                      |    3 +++
 contrib/sb-bsd-sockets/win32-sockets.lisp |   12 ++++++++++--
 version.lisp-expr                         |    2 +-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 460fd62..767cb73 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,9 @@ changes in sbcl-1.0.25 relative to 1.0.24:
     longer reuses the functional from the previous expansion site.
   * bug fix: DEFTYPE no longer breaks on bodies consisting of a single
     unquoted symbol. Regression from 1.0.22.8. (reported by Ariel Badichi)
+  * improvements to the Windows port:
+    ** SB-BSD-SOCKETS now works from saved cores as well. (reported by Stephen
+       Westfold, thanks to Rudi Schlatte)
 
 changes in sbcl-1.0.24 relative to 1.0.23:
   * new feature: ARRAY-STORAGE-VECTOR provides access to the underlying data
diff --git a/contrib/sb-bsd-sockets/win32-sockets.lisp b/contrib/sb-bsd-sockets/win32-sockets.lisp
index 5b20df5..7aa765a 100644
--- a/contrib/sb-bsd-sockets/win32-sockets.lisp
+++ b/contrib/sb-bsd-sockets/win32-sockets.lisp
@@ -68,8 +68,16 @@
 (defun make-wsa-version (major minor)
   (dpb minor (byte 8 8) major))
 
-(defvar *wsa-startup-call*
-  (wsa-startup (make-wsa-version 2 2)))
+(defvar *wsa-startup-call* nil)
+
+(defun call-wsa-startup ()
+  (setf *wsa-startup-call* (wsa-startup (make-wsa-version 2 2))))
+
+;;; Startup!
+(call-wsa-startup)
+
+;;; Ensure startup for saved cores as well.
+(push 'call-wsa-startup sb-ext:*init-hooks*)
 
 ;; not implemented on win32
 (defconstant af-local 0)
diff --git a/version.lisp-expr b/version.lisp-expr
index b43f299..9793066 100644
--- a/version.lisp-expr
+++ b/version.lisp-expr
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.24.45"
+"1.0.24.46"
-- 
1.7.10.4