diff --git a/src/bindings.lisp b/src/bindings.lisp index a409a9f8..ad39dfd1 100644 --- a/src/bindings.lisp +++ b/src/bindings.lisp @@ -124,14 +124,21 @@ defining an error map with a non-nil FATAL-ERROR is undefined.") :if-exists :supersede) (format stream "#define ~A~%~%" build-flag) (format stream "#include ~s~%~%" header-name) + #-win32 (format stream "#include ~%") + #+win32 + (format stream "#include ~%") (format stream "#include ~%~%") + #-win32 (format stream "__thread jmp_buf fatal_lisp_error_handler;~%~%") + #+win32 + (format stream "__thread intptr_t fatal_lisp_error_handler[5];~%~%") (when *non-static-lossage-handler* (format stream "extern void (*lossage_handler)(void);~%~%")) (format stream "extern void ldb_monitor(void);~%~%") (format stream "int fatal_sbcl_error_occurred = 0;~%~%") - (format stream "void return_from_lisp(void) { fatal_sbcl_error_occurred = 1; fflush(stdout); fflush(stderr); longjmp(fatal_lisp_error_handler, 1); }~%~%") + (format stream "void return_from_lisp(void) { fatal_sbcl_error_occurred = 1; fflush(stdout); fflush(stderr); ~a(fatal_lisp_error_handler, 1); }~%~%" + #-win32 "longjmp" #+win32 "__builtin_longjmp") (dolist (api (library-apis library)) (write-api-to-source api stream)) (unless omit-init-function diff --git a/src/function.lisp b/src/function.lisp index 92379369..e8019c6a 100644 --- a/src/function.lisp +++ b/src/function.lisp @@ -91,11 +91,12 @@ cause a normal crash and not return control to this function." (list "result")))))) (format nil "~a {~%~a~%}~%" header - (format nil " if (!setjmp(fatal_lisp_error_handler)) { + (format nil " if (!~a(fatal_lisp_error_handler)) { ~a } else { ~a - }" call-statement (if (and error-map (error-map-fatal-code error-map)) + }" #-win32 "setjmp" #+win32 "__builtin_setjmp" + call-statement (if (and error-map (error-map-fatal-code error-map)) (format nil "return ~d;" (error-map-fatal-code error-map)) (format nil "ldb_monitor();"))))))))