[plt-scheme] FFI - Implicit binding of _int to the correct _int32 or _int64

From: Ray Racine (ray.racine at comcast.net)
Date: Wed Sep 26 18:44:24 EDT 2007

I'm bouncing back and forth between a 64 bit machine and a 32 bin on
FC7.

The following code snip is from

(planet "hmac-sha1.ss" ("jaymccarthy" "hmac-sha1.plt" 1 1)))

In the below code I've changed what were _int to _int64 types.  If leave
them as _int, I segfault on the 64 bit machine.  

(define HMAC-SHA1/raw
    (get-ffi-obj 'HMAC openssl-crypto
                 (_fun [EVP_MD : _fpointer = (EVP_SHA1)]
                       [key : _bytes]
                       [key_len : _int64 = (bytes-length key)]
                       [data : _bytes]
                       [data_len : _int64 = (bytes-length data)]
                       [md : _int64 = 0]
                       [md_len : _int64 = 0]
                       ->
                       _pointer)))

Does / should the FFI automatically bind _int to _int32 or _int64 
i.e. the "right" size?

Otherwise any suggestions on how to change the below FFI definition so
it works on both a 64 and 32 bit system?  

Thanks,

Ray



Posted on the users mailing list.