[Ecls-list] :CSTRING cannot be used anymore as FFI argument (sockets.lisp does not compile)
Juan Jose Garcia Ripoll
lisp at arrakis.es
Mon Oct 10 03:01:53 UTC 2005
On Mon, 2005-10-10 at 10:48 +0200, Goffioul Michael wrote:
> 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?
The "fix" included a translation of all c-inline forms to forms that do
not contain :cstring. It seems I did not get it right.
In any case, the motivation for this change is that
ecl_string_safe_pointer() is not safe. The pointer may be garbage
collected if it is not contained in a string. This is particularly so
with the older garbage collector.
The only safe way of having null terminated strings is to first create a
string without a fill pointer, keep a reference to this lisp object
somewhere and use the pointer from this string. In practice this means
enclosing all C-INLINE forms into WITH-CSTRING. This is what my latest
change tried to do.
I will look into that.
Regards,
Juanjo
More information about the ecl-devel
mailing list