Created
June 6, 2019 21:45
-
-
Save Lovesan/eff406bb0201af74371248b59c246a92 to your computer and use it in GitHub Desktop.
SBCL code for testing cross-boundary exceptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(sb-alien:load-shared-object "unwind.dll") | |
(sb-alien:define-alien-routine | |
("catches_fn" catches-fn) | |
sb-alien:void | |
(fn (* T))) | |
(defun sap-to-callable (ptr) | |
(sb-alien:sap-alien | |
(sb-alien:alien-sap ptr) | |
(function sb-alien:void))) | |
(sb-ext:defglobal | |
alien-callback | |
(sb-alien:alien-sap | |
(sb-alien::alien-lambda sb-alien:void ((ptr (* t))) | |
(format *error-output* "Lisp callback~%") | |
(unwind-protect (sb-alien:alien-funcall (sap-to-callable ptr)) | |
(format *error-output* "Lisp unwind"))))) | |
(defun test-seh () | |
(catches-fn alien-callback) | |
(values)) | |
(test-seh) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment