Hi all,

I have a C shared library exposing a simplified interface for computing message 
digests. Here's a `while` that reads bytes using a callback.

https://github.com/zyrolasting/xiden/blob/libcrypto/crypto/crypto.c#L46

A compatible callback provided by Racket might look like this.

(λ (buf size)
(let ([bytes-read (read-bytes! buf (sync variant))])
(if (eof-object? bytes-read) -1 bytes-read)))

I'm also unsure if jumping between the Racket and C runtimes add much overhead, 
but I did it because it looks like `unsafe-port->file-descriptor` will only 
function as expected for file ports.

Is there a cross-VM way to pass an arbitrary input port to the C runtime (e.g. 
via open-input-bytes), such that the C runtime can read bytes on its own?

--
~slg

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/ee17c05f-3c89-3094-8f9a-d634ddb1d25d%40sagegerard.com.

Reply via email to