On Sat, 19 Jul 2008 13:27:46 -0700, css <[EMAIL PROTECTED]> wrote: > Hello. > > 2008/7/19 Luke Crook <[EMAIL PROTECTED]>: >> On Fri, 18 Jul 2008 16:00:39 -0700, css <[EMAIL PROTECTED]> wrote: >> >>> >>> (defun load-image-from-byte-sequence (byteseq) >>> (make-instance 'sdl:surface >>> :surface >>> (sdl-cffi::sdl-load-bmp-rw >>> (sdl-cffi::with-foreign-string (str byteseq) >>> (sdl-cffi::sdl-rw-from-mem str (length byteseq))) >>> 1))) >>
> Thank you. It works. It may be a stupid question, but what is the main > difference between these both things? I mean they are both strings - > at least for C - a sequence of bytes. Just for my interest. It seems that SDL_rwops does not maintain an internal copy of the data, but rather references the external array. So WITH-FOREIGN-STRING had freed the memory before SDL-LOAD-BMP-RW had a chance to create the SDL_surface. It was probably just luck that this worked at all. Using FOREIGN-STRING-ALLOC probably will work in this case. - Luke _______________________________________________ application-builder mailing list [email protected] http://www.lispniks.com/mailman/listinfo/application-builder
