At Mon, 22 Nov 2010 09:29:22 -0500, Eric Dobson wrote: > I am interfacing with a foreign library and have a datatype whose > representation in racket is a cpointer, where equality is ptr-equal?. > I want to make a struct encapsulating this using prop:equal+hash to > make struct equality match the foreign library's equality operator. Is > there a way to get something that I could use to make the hash > function? I wanted to get the actual pointer value, but did not see a > way of extracting that from the cpointer, only the offset.
You could cast a pointer `p' to a long using (cast v _pointer _intptr) Meanwhile, I've just changed Racket so that C pointers are `equal?' when they reference the same address, and so `equal-hash-code' produces a value that depends only on the address (and would be useful for computing a hash code for an encapsulating structure). _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users