[cffi-devel] How to pass foreign pointer to c function

Luís Oliveira luismbo at gmail.com
Wed Dec 5 21:53:32 UTC 2007


On 30/11/2007, fungsin <fungsin.lui at gmail.com> wrote:
>     return rl_bind_key_in_map (key, func, emacs_meta_keymap);

AFAICT, emacs_meta_keymap is an array. My C-fu is getting weak but I
think that in this particular case emacs_meta_keymap (or
&emacs_meta_keymap[0]) == &emacs_meta_keymap.


> (cffi:defcvar ("emacs_meta_keymap" emacs_meta_keymap)
>  :pointer)

So, given that definition, the equivalent of &emacs_meta_keymap is
(get-var-pointer 'emacs_meta_keymap). Alternatively, you can use
(foreign-symbol-pointer "emacs_meta_keymap").

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/



More information about the cffi-devel mailing list