lispgames / cl-sdl2

Common Lisp bindings for SDL2 using C2FFI.
MIT License
304 stars 82 forks source link

c-with inside query-texture fails on :uint32 #60

Closed npatrick04 closed 8 years ago

npatrick04 commented 8 years ago

I'm running this with SBCL 1.3.1 on Windows 10.

From quicklisp: cl-sdl-20151218 cl-autowrap-20151218

It's failing to find :uint32 in cffi-sys. In looking through the cffi source, it looks like the stdint.h typedefs aren't available until you reach the cffi layer. I don't know if there's a way to fix this in the autowrap header or not. For now, I can get around it by replacing :uint32 with :unsigned-int.

:UINT32 fell through ECASE expression.
Wanted one of (:CHAR :UNSIGNED-CHAR :SHORT :UNSIGNED-SHORT :INT
               :UNSIGNED-INT :LONG :UNSIGNED-LONG :LONG-LONG
               :UNSIGNED-LONG-LONG :FLOAT :DOUBLE :POINTER
               :VOID).
   [Condition of type SB-KERNEL:CASE-FAILURE]

Restarts:
 0: [*CONTINUE] Return to the SDL2 main loop.
 1: [ABORT] Abort, quitting SDL2 entirely.
 2: [ABORT] abort thread (#<THREAD "SDL2 Main Thread" RUNNING {26C644E9}>)

Backtrace:
  0: (SB-KERNEL:CASE-FAILURE ECASE :UINT32 (:CHAR :UNSIGNED-CHAR :SHORT :UNSIGNED-SHORT :INT :UNSIGNED-INT ...))
  1: (CFFI-SYS::CONVERT-FOREIGN-TYPE :UINT32)
  2: (CFFI-SYS:%FOREIGN-TYPE-SIZE :UINT32)
  3: (AUTOWRAP:ALLOC-PTR :UINT32 1)
  4: (SDL2:QUERY-TEXTURE #<SDL2-FFI:SDL-TEXTURE {#X001B38D0}>)
  5: (RENDER-TILED #<SDL2-FFI:SDL-TEXTURE {#X001B38D0}> #<SDL2-FFI:SDL-RENDERER {#X001B4F30}>)
  6: ((LAMBDA NIL :IN LESSON-2))
  7: (SDL2::HANDLE-MESSAGE (#<FUNCTION (LAMBDA NIL :IN LESSON-2) {27417075}> . #S(TRIVIAL-CHANNELS:CHANNEL :QUEUE #S(TRIVIAL-CHANNELS.QUEUE:QUEUE :HEAD NIL :TAIL NIL) :Q-CONDITION #<SB-THREAD:WAITQUEUE Ano..
  8: (SDL2::SDL-MAIN-THREAD)
TatriX commented 8 years ago

Please use the master branch. Git clone it into the quicklist/local-projects.

rpav commented 8 years ago

Sorry should have caught that. (And need to investigate why this isn't getting caught at compile-time.) Types that are not one of the basic listed types are not keywords.

rpav commented 8 years ago

Err, just actually committed the right fix. Had found another too. ;)

npatrick04 commented 8 years ago

Sweet, the last fix did it. Thanks.