Skip to content

Instantly share code, notes, and snippets.

@cbaggers
Last active April 15, 2018 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbaggers/caeba24cdc9ceff164feadcc876b25c9 to your computer and use it in GitHub Desktop.
Save cbaggers/caeba24cdc9ceff164feadcc876b25c9 to your computer and use it in GitHub Desktop.
kill cl-sdl2 on sbcl
#+sbcl
(eval-when (:compile-toplevel :load-toplevel :execute)
(sb-int:set-floating-point-modes :traps nil))
(defpackage :moo (:use :cl :sdl2))
(in-package :moo)
(defun print! (x &rest args)
(format t "~%~a~{ ~s~}" x args)
(finish-output)
x)
(defun death ()
(print! "hi")
(print! "about to init")
(sdl2::check-rc
(sdl2-ffi.functions:sdl-init
(autowrap:mask-apply 'sdl2::sdl-init-flags '(:everything))))
;;(sdl2:create-window)
(print! "was init" (sdl2:was-init :everything))
(unwind-protect
(progn
(print! "next will poll a single event a bunch of times")
(loop :for i :below 300 :do
(sdl2::sdl-pump-events))
(print! "event poll'd"))
(print! "about to quit")
(print "quit:" (sdl2::sdl-quit))
(print! "successfully quit")))
;; - `(ql:quickload :sdl2)`
;; - compile this file
;; - `(moo::death)`
;; - dies with 'Process inferior-lisp segmentation fault: 11'
@metayan
Copy link

metayan commented Apr 15, 2018

Strange, the (sb-int:set-floating-point-modes :traps nil) is not executed when compiling with C-c C-k.
If executed in the REPL, it works. With (sdl2:create-window) uncommented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment