[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*Help*: adjustable array from Lisp to C??



Hi:

I am trying to pass a string with variable size from Lisp to C,
and expect that C would change the value of the string.
--------------

(defforeign 'str_test
	    :arguments '(string)
            :return-type :void)

(setf str (make-array 0
                      :element-type 'string-char
                      :adjustable t))



(str_test str)

------------------

void str_test(str)
char *str;

{
   .
   .
   strcpy(str,finalstr);
   .
   .
}

------------------

I failed to change the value of "str" when C returned the control
to Lisp. I had to change "str" to:

    (setf str (make-array *BUFFER-SIZE*
                          :element-type 'string-char
                          :fill-pointer t))

in order for the program to work.

My question is: How can we pass an array with adjustable size to C?


Thanks.