[racket] forward pointer declarations

From: Anthony Carrico (acarrico at memebeam.org)
Date: Mon Feb 2 09:41:46 EST 2015

Along these lines, I also am a little foggy on unions. This:
  http://docs.racket-lang.org/foreign/C_Union_Types.html

says, "Unions are always treated like structs." But I have no idea what
that phrase means. I don't get the impression that unions have tags like
structs can have. Or can they? Maybe any pointer can be tagged? For example:

(define _wl_argument
  (_union _int32
          _uint32
          _wl_fixed
          _string/utf-8
          (_cpointer/null 'wl_object)
          _uint32
          _wl_array-pointer
          _int32))

Now suppose I need to pass an array of _wl_argument. Does it even make
sense to use a tag in the _cpointer?

(define _wl_argument-pointer (_cpointer 'wl_argument))

(define-wl-client wl_proxy_marshal_array_constructor
  (_fun #:save-errno 'posix
        _wl_proxy-pointer
        _uint32
        _wl_argument-pointer
        _wl_interface-pointer
        -> _wl_proxy-pointer/null
        ))

So as I said, I'm just a little foggy on some of the concepts, but I do
think the FFI is very nice. Maybe I'm just trying to use stronger typing
than actually exists in the ffi. I've started reading
Eli Barzilay/Dmitry Orlovsky "Foreign Interface for PLT Scheme".

-- 
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/b5d986ce/attachment.sig>

Posted on the users mailing list.