[racket] forward pointer declarations

From: Anthony Carrico (acarrico at memebeam.org)
Date: Mon Feb 2 08:02:43 EST 2015

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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.racket-lang.org/users/archive/attachments/20150202/f5494983/attachment.sig>

Posted on the users mailing list.