From: ········@my-deja.com
Subject: ACL6.0 / ACL5 issue w FFI char*
Date: 
Message-ID: <8tkgo4$95$1@nnrp1.deja.com>
To any Allegro foreign function wizards -

foreign function code that worked with linux ACL 5.01 that I have
written does not work with my new trial ACL 6

I want to allocate a variable in Lisp, send it to a function,
and have the C function change the variable. I cannot get
char* to work:

e.g:

given the c function

int sw_string_test(char* in_out);

/* assume an alreay allocated string comes in w max 10 bytes */
int sw_string_test (char* in_out)
{
  memcpy(in_out,"0123456789",10);
  return 0;
}

In lisp:

(ff:def-foreign-call sw_string_test ((name (* :char)))
  :returning :int)


(defun test-string()
  (let(( name (make-array 10
			 :element-type 'character
			 :initial-element #\Null)))
    (sw_string_test name)
    name))


In ACL 5.01, the lisp variable called name acquires the string
USER(3): (test-string)
"0123456789"             <----name is assigned as desired

In ACL 6.0, the lisp variable called name is unaffected:
cl-user(2): (test-string)
""                        <---name is not assigned


Any help would be great in what I am doing wrong for the new
version.

dave linenberg







Sent via Deja.com http://www.deja.com/
Before you buy.

From: Charles A. Cox
Subject: Re: ACL6.0 / ACL5 issue w FFI char*
Date: 
Message-ID: <8tnhea$ief$1@news2.franz.com>
<········@my-deja.com> wrote in message ················@nnrp1.deja.com...
> To any Allegro foreign function wizards -
>
> foreign function code that worked with linux ACL 5.01 that I have
> written does not work with my new trial ACL 6
>
> I want to allocate a variable in Lisp, send it to a function,
> and have the C function change the variable. I cannot get
> char* to work:

Please look at the ``Foreign-Functions'' section in ACL 6.0's online
documentation's iacl.htm, available over the internet as follows:

 http://www.franz.com/support/documentation/6.0/doc/iacl.htm

In this section you will find an example very similar to the one you
posted along with discussion on how to update the code and why it is
necessary for it to be updated in Allegro CL 6.0.

If you have further questions, please feel free to follow up to
·····@franz.com'.

    Charley
From: dave linenberg
Subject: Re: ACL6.0 / ACL5 issue w FFI char*
Date: 
Message-ID: <39FF5FA7.A2C104E2@home.com>
Thanks!!

I was looking in foreign-functions.htm and ftype.htm but I neglected the
iacl.htm.
I should of looked a little more deeply at the docs.

Dave





"Charles A. Cox" wrote:

>
> Please look at the ``Foreign-Functions'' section in ACL 6.0's online
> documentation's iacl.htm, available over the internet as follows:
>
>  http://www.franz.com/support/documentation/6.0/doc/iacl.htm
>
>     Charley