Date: Thu, 9 Jun 1994 07:01 PDT
From: Ronald S. Chong <······@dip.eecs.umich.edu>
hi all:
i'm fumbling around trying to learn foreign functions calls to c. the
:return-type keyword argument for ff:defforeign doesn't have a value
that would permit strings to returned from the c function. how is
this typically done. thanks.
/r/
It looks like you're referring to allegro. There's a
c-string-to-lisp-string function. A little macrology can conceal this
deficiency from the enduser:
(macroexpand-1 '(ffc:def-ffun foo (a) :return-type :string))
(PROGN (FOREIGN-FUNCTIONS:DEFFOREIGN 'FOO%INTERNAL
:LANGUAGE :C
:RETURN-TYPE ':INTEGER
:ENTRY-POINT '"foo"
:PROTOTYPE T
...)
(DEFUN FOO (FFC::ARG1)
(LET ((FFC::V #))
(UNLESS (EQL FFC::V 0)
(FOREIGN-FUNCTIONS:CHAR*-TO-STRING FFC::V))))
)