[racket] forward pointer declarations

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Mon Feb 2 09:04:25 EST 2015

Maybe a ctype which is a delay node, along the lines of
'recursive-contract', is the right thing here.

Sam

On Mon, Feb 2, 2015, 8:05 AM Anthony Carrico <acarrico at memebeam.org> wrote:

> On 02/02/2015 01:17 AM, Matthew Flatt wrote:
> > It's also valid to reference `wl_interface-pointer` directly:
> ...
> >
> > I don't have a nicer solution if you want to refer to
> > `_wl_message-pointer`, though.
> >
>
> The forward reference is actually in wl_message, like this:
>
> (define-cstruct _wl_message
>   ((name _string/utf-8)
>    (signature _string/utf-8)
>    (types (_cpointer 'wl_interface))))
>
> (define-cstruct _wl_interface
>   ((name _string/utf-8)
>    (version _int)
>    (method_count _int)
>    (methods _wl_message-pointer)
>    (event_count _int)
>    (events _wl_message-pointer)))
>
> I ended up just inlining (_cpointer 'wl_interface) for the forward
> reference. This ends up creating two (_cpointer 'wl_interface) ctypes,
> but it's no problem, correct?
>
> I don't think it is possible to "reference 'wl_interface-pointer'
> directly" as you suggest in this case because of the "cannot reference
> an identifier before its definition" error.
>
> --
> Anthony Carrico
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20150202/0b9778b6/attachment.html>

Posted on the users mailing list.