Re: :pointer-self and LispWorks

Edi Weitz <[email protected]> 12 Aug 2003 15:39:15 +0200
Newsgroups gmane.lisp.uffi.general
Message-ID <[email protected]>
Hi Kevin!

You've been too fast for me... :)

Looks like I've found a solution - see below.

On Tue, 12 Aug 2003 07:33:53 -0600, Kevin Rosenberg <kevin-HJRc7zDS/[email protected]> wrote:

> Actually, I get the same sort of error trying this:
> 
>  > (uffi:def-struct foo2 (bar :foo-ptr2))
> (:STRUCT FOO2)
>                                                                               
> > (uffi:def-foreign-type foo-ptr2 (* foo2))
> FOO-PTR2
> 
> > (fli:with-dynamic-foreign-objects ((p foo2)) )
> Error: Illegal foreign type :FOO-PTR2.
> 
> The expansion of the def-struct in this case is:
> > (macroexpand-1 '(uffi:def-struct foo2  (bar :foo-ptr2)))
> (FLI:DEFINE-C-STRUCT FOO2 (BAR :FOO-PTR2))

Here the problem seems to be that you have to use

  (uffi:def-struct foo2 (bar foo-ptr2))

and not

  (uffi:def-struct foo2 (bar :foo-ptr2))

> This is with LWL 4.2.7. So, I'm unsure of how to define a foreign
> structure in lispworks that contains a pointer. If you can let me
> know the Lispworks syntax for that, then I can modify UFFI's
> def-struct macro to emit the compliant code.

I think this should work:

--- aggregates.lisp.orig        Tue Aug 12 15:30:51 2003
+++ aggregates.lisp     Tue Aug 12 15:32:01 2003
@@ -80,7 +80,8 @@
                              #+(or cmu scl) `((* (alien:struct ,name)))
                              #+sbcl `((* (sb-alien:struct ,name)))
                              #+mcl `((:* (:struct ,name)))
-                             #-(or cmu sbcl scl mcl) `((* ,name))
+                             #+lispworks `((:pointer ,name))
+                             #-(or cmu sbcl scl mcl lispworks) `((* ,name))
                              `(,(convert-from-uffi-type type :struct))))))
        (if variant
            (push (list def) processed)


Cheers,
Edi.