[cffi-devel] Re: Passing a struct by value

Luís Oliveira luismbo at gmail.com
Wed Jun 7 14:57:14 UTC 2006


Luke Crook <luke at balooga.com> writes:
> I've read: http://article.gmane.org/gmane.lisp.cffi.devel/754 stating
> that CFFI does not support passing structs by value. Unfortunately I
> need to pass a SDL_Color struct *by value* to the SDL_ttf library in
> order to set the character/font color prior to rendering.

Right, that's because most lisps don't support this. But we could in
theory add this to CFFI for lisps that support it. (I think OpenMCL
supports this.)


> I'll need to write some 'glue' code in C to do this conversion. Does
> anyone have any suggestions on the best way I should implement this? A
> 'wrapper' function in a helper DLL that will take the SDL_Color struct
> pointer from CFFI and call the SDL_ttf function passing the struct as
> a value?

Either that or a C function which accepts an argument for each of
SDL_Color's struct members.

-- 
Luís Oliveira
luismbo (@) gmail (.) com
http://student.dei.uc.pt/~lmoliv/




More information about the cffi-devel mailing list