[Ecls-list] :CSTRING cannot be used anymore as FFI argument (sockets.lisp does not compile)
Goffioul Michael
goffioul at imec.be
Mon Oct 10 02:30:40 UTC 2005
> I noticed that latest changes forbid to have :CSTRING as FFI
> argument to
> a C-INLINE call. Now, sockets.lisp does not compile anymore.
> The question
> is:
> - what's the correct fix? Replace :CSTRING with :CHAR*?
> - shouldn't this be done automatically in c1c-inline?
It turns out that there were some errors in cmpffi.lsp, here's
a possible fix:
Index: src/cmp/cmpffi.lsp
===================================================================
RCS file: /cvsroot/ecls/ecls/src/cmp/cmpffi.lsp,v
retrieving revision 1.17
diff -u -3 -p -r1.17 cmpffi.lsp
--- src/cmp/cmpffi.lsp 10 Oct 2005 08:42:22 -0000 1.17
+++ src/cmp/cmpffi.lsp 10 Oct 2005 09:25:14 -0000
@@ -255,16 +255,16 @@
;; null-terminated strings, but not all of our lisp strings will
;; be null terminated. In particular, those with a fill pointer
;; will not.
- (let ((ndx (position :cstring arguments)))
+ (let ((ndx (position :cstring arg-types)))
(when ndx
(let* ((var (gensym))
- (value (elt ndx arguments)))
- (setf (elt ndx arguments) var
- (elt ndx arg-types) :char*)
+ (value (elt arguments ndx)))
+ (setf (elt arguments ndx) var
+ (elt arg-types ndx) :char*)
(return-from c1c-inline
- `(with-ctring (,var ,value)
- (c1c-inline ,arguments ,arg-types ,output-type ,c-expression
- , at rest))))))
+ (c1expr `(with-ctring (,var ,value)
+ (c1c-inline ,arguments ,arg-types ,output-type ,c-expression
+ , at rest)))))))
;; Find out the output types of the inline form. The syntax is rather relax
;; output-type = lisp-type | c-type | (values {lisp-type | c-type}*)
(flet ((produce-type-pair (type)
However, I'm not sure this is the right way to do it. Especially, the WITH-CSTRING
is compiled into a funcall to WITH-CSTRING function; in other words, the WITH-CSTRING
macro is not expanded before compilation. Juanjo?
Side note: the change in :CSTRING argument handling forbids to use such an argument
type for an output buffer of the C function (ex: gethostname function). So I have no
idea is the sockets code is still functional, this needs to be checked.
Michael.
More information about the ecl-devel
mailing list