[Ecls-list] UFFI returning a cl_object
Juan Jose Garcia-Ripoll
jjgarcia at users.sourceforge.net
Sun Jun 1 18:09:55 UTC 2008
On Sat, May 31, 2008 at 8:40 PM, Shoaib Kamil <shoaibkamil at gmail.com> wrote:
> Hi,
>
> I'm trying to use a C function that returns a cl_object through UFFI.
> I can get the function to work, but I can't get ECL to recognize what
> it returns as a lisp object (it is a list). My def-function line
> looks like:
>
> (uffi:def-function ("parse_from_file" pff) ((arg :cstring)) )
>
> The function parse_from_file is a C function that returns a cl_object.
> I've tried using various things for the :returning keyword in
> def-function, but to no avail. Is this something possible with ECL?
> Any help is really appreciated, thanks.
Use the internal type :object
--- foo.lsp ---
(ffi:clines "
cl_object
foo(const char *arg) {
return make_simple_base_string(arg + 2);
}
")
(uffi:def-function ("foo" pff) ((arg :cstring)) :returning :object)
--command line---
> (compile-file "foo" :load t)
;;; Compiling foo.
;;; Compiling (DEFUN PFF ...).
;;; End of Pass 1. [...]
NIL
NIL
> (pff "hola")
"la"
--
Facultad de Fisicas, Universidad Complutense,
Ciudad Universitaria s/n Madrid 28040 (Spain)
http://juanjose.garciaripoll.googlepages.com
More information about the ecl-devel
mailing list