[Ecls-list] RUN-PROGRAM/FFI
Juan Jose Garcia Ripoll
lisp at arrakis.es
Wed Nov 16 05:30:03 UTC 2005
On Wed, 2005-11-16 at 13:14 +0100, Nicolas Neuss wrote:
> 1. I need to open a pipe between Femlisp and OpenDX. How is that done
> in
> ECL? Where could I find documentation about it?
> (http://ecls.sourceforge.net/ecl/OS-interface.html#OS-interface
> is probably not all, I guess)
No, you also have RUN-PROGRAM, much like in CMUCL. From
ecls/src/c/unixsys.d:
@(defun ext::run-program (command argv &key (input @':stream')
(output @':stream') (error @'t'))
> 2. I want to call a C function and to pass it an array. How is that
> done?
> Is there some conversion routine like VECTOR-SAP in CMUCL/SBCL?
> Where
> could I find information about ECL's FFI?
This is not really supported, because such pointers are unsafe. However,
you can do it with a simple c-inline statement:
(c-inline (my-array) (:object) :pointer-void
"(#0)->array.self.char" :one-liner t)
Afterwards you can use this in any FFI call. Beware however that you
must keep a reference to the original array somewhere, because otherwise
the data will be garbage collected, the pointer will no longer be valid,
you may cause buffer overflows, planes will crash, etc, etc.
Regards,
Juanjo
More information about the ecl-devel
mailing list