From 2ba109a5fd136bbef29b618a1d60e63fae971187 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Mon, 5 May 2003 21:57:50 +0000 Subject: [PATCH] r4817: Auto commit for Debian build --- debian/changelog | 6 ++++++ doc/ref.sgml | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/debian/changelog b/debian/changelog index 27859e2..dccfffe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-uffi (1.2.15-1) unstable; urgency=low + + * Documentation improvement by Nikodemus Siivola + + -- Kevin M. Rosenberg Mon, 5 May 2003 15:57:32 -0600 + cl-uffi (1.2.14-1) unstable; urgency=low * New upstream diff --git a/doc/ref.sgml b/doc/ref.sgml index f299c19..510dd4c 100644 --- a/doc/ref.sgml +++ b/doc/ref.sgml @@ -1543,6 +1543,25 @@ string for a return value. (error "gethostname() failed.")))) + Foreign functions that return pointers to freshly allocated +strings should in general not return cstrings, but foreign strings. +(There is no portable way to release such cstrings from Lisp.) The +following is an example of handling such a function. + + +(uffi:def-function ("readline" c-readline) + ((prompt :cstring)) + :returning (* :char)) + +(defun readline (prompt) + "Reads a string from console with line-editing." + (with-cstring (c-prompt prompt) + (let* ((c-str (c-readline c-prompt)) + (str (convert-from-foreign-string c-str))) + (uffi:free-foreign-object c-str) + str))) + + -- 2.34.1