Skip to content

Conversation

97jaz
Copy link
Contributor

@97jaz 97jaz commented Dec 3, 2012

This is a tiny change to allow prop:cpointer to work the way the documentation says it does:

The property value must be either an exact non-negative integer indicating an
immutable field in the structure (which must, in turn, be initialized to a C pointer
value), a procedure that takes the structure instance and returns a C pointer
value, or a C pointer value.

Procedure values don't currently work. Test case:

#lang racket/base

(require ffi/unsafe)
(struct foo (ptr)
  #:property prop:cpointer 0)

(define a-foo (foo (malloc 16 'raw)))
(free a-foo)

(struct bar (ptr)
  #:property prop:cpointer (λ (s) (bar-ptr s)))

(define a-bar (bar (malloc 16 'raw)))
(free a-bar)

@elibarzilay
Copy link
Member

Merged, thanks!

@elibarzilay elibarzilay closed this Dec 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants