Subject: foreign function interface

From: [email-masked] (Dan Stanger)
Date: Fri, 16 Jun 1995 16:34:39 -0600

is is possible to use the following construct?
(defconstant _SYS_NMLN           32)
(def-c-struct utsname 
  (sysname (c-array char _SYS_NMLN))
...
when i try it i get the following error
*** - Invalid FFI type: (C-ARRAY CHAR _SYS_NMLN)
but this works
(sysname (c-array char 32 ))

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

thanks,
dan stanger

---

From: haible (Bruno Haible)
Date: Sat, 17 Jun 95 00:46:09 +0200

>   (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))

> 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
                    [email-masked]