[Ecls-list] C-STRINGs and lisp strings

Goffioul Michael goffioul at imec.be
Tue Jun 28 06:39:19 UTC 2005


> [...After some thinking...]
> 
> I think I have found the right fix. Reading the UFFI manual, 
> C-STRING is 
> expected to be some type of string that can be passed to the 
> C world. If 
> one expects to have some "buffer" which can be written to by a C 
> routine, then one has to create a C-STRING. Ok then the 
> solution is to 
> enforce that these C-STRING be a lisp simple-string . In 
> other words, a 
> string which has no fill pointer and has as many characters 
> as the user 
> expected. Then ECL's rule that all strings have a null 
> character at the 
> end will be enough.
> 
> The fix has been committed to CVS. Please raise your hands if I am 
> allowed to close the associated bug report in Sourceforge.

I looked at the CVS notification mail and I have the impression that
the problem still exists in case like:

(ffi:def-function ("strlen" f1) ((arg :cstring)) :returning :unsigned-int)
(f1 (format nil "~{~A~^, ~}" '(a b c d)))

The FORMAT call returns a non-simple string, and the generated code for F1
will probably only call ecl_string_pointer_safe() on it.

Am I right?

Michael.




More information about the ecl-devel mailing list