Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site dcdwest.UUCP
Path: utzoo!linus!philabs!cmcl2!seismo!lll-crg!dual!qantel!hplabs!sdcrdcf!sdcsvax!dcdwest!benson
From: benson@dcdwest.UUCP (Peter Benson)
Newsgroups: net.lang.lisp
Subject: Passing strings back to Lisp
Message-ID: <203@dcdwest.UUCP>
Date: Tue, 6-Aug-85 12:03:13 EDT
Article-I.D.: dcdwest.203
Posted: Tue Aug  6 12:03:13 1985
Date-Received: Tue, 13-Aug-85 00:51:11 EDT
Distribution: net
Organization: ITT Defense Communications (San Diego)
Lines: 35

In Franz Lisp 38.79 under Berkeley 4.2, the way one might pass a
string from a foreign sub-routine to lisp might look like
this:

char *
return_string()
{
	static char *item = "Return_String";
	s = (char *)calloc(strlen(item)+1,1);
	strcpy(s, item);
	return(s);
}

The function would be compiled and then loaded using something
like:


(removeaddress '_return_string)
(cfasl 'string.o '_return_string 'return_string "function" )

Nevertheless, the string which is returned is inaccessible
since it is outside the address space of Lisp.  The returned
value is always on the order of

#Other-9cd24

Does anyone know how to return strings in a reasonable way?


-- 
                                _
Peter Benson                    | ITT Defense Communications Division
(619)578-3080                   | 10060 Carroll Canyon Road
decvax!ittvax!dcdwest!benson    | San Diego, CA 92131
ucbvax!sdcsvax!dcdwest!benson   |