[fetter-devel] Verrazano and ncurses

Luís Oliveira luismbo at gmail.com
Wed Dec 7 02:55:24 UTC 2005


On 2005-dec-06, at 03:46, Brad Beveridge wrote:

> Well, although I am an idiot, and I was using the wrong function.
> However, my question still stands.  How do I easily convert a lisp
> string to the :pointer type that the Verrazano generated function
> expects?
> As another question, how come VZN generated in this particular way?
> The C header describes addstr as
> extern NCURSES_EXPORT(int) addstr (const char *);

I suppose that, ideally, Verrazano should output an FFI declaration  
using :string for that function.

Answering your question, you can convert a Lisp string to a newly- 
allocated C string using cffi:foreign-string-alloc (which you can  
then free with cffi:foreign-string-free) or you can use the cffi:with- 
foreign-string macro (probably what you want).

See the CFFI User Manual for examples. Check out the other string- 
related functions and macros available too.

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/
Equipa Portuguesa do Translation Project
http://www.iro.umontreal.ca/translation/registry.cgi?team=pt




More information about the fetter-devel mailing list