[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: foreign function interface



Dan Stanger <dxs@evolving.com> asks:

> is is possible to use the following construct?
> (defconstant _SYS_NMLN           32)
> (def-c-struct utsname 
>   (sysname (c-array char _SYS_NMLN))

Unfortunately this is not possible. You have to use #. :

(def-c-struct utsname 
  (sysname (c-array char #._SYS_NMLN))

> also, is there a way to pass c code directly through the compilation process?
> via a special comment (for example)

No, an interface for doing that is missing. The only way to do that now
is to pack the C code into a separate C file which you then link against.

An unportable way of outputting C code directly (between functions) is

(eval-when (compile)
  (when (compiler::prepare-coutput-file)
    (format compiler::*coutput-stream* ...stuff...)
) )


                    Bruno Haible
                    haible@ma2s2.mathematik.uni-karlsruhe.de