[racket] ffi/unsafe examples

From: Ben Dean (benjamin.dean at aya.yale.edu)
Date: Mon Feb 7 13:51:19 EST 2011

I'm looking to put some Racket wrappers around bits of the OpenCV C api, but
I'm having a hard getting started. I've looked through the ffi/unsafe
documentation several times, but something isn't clicking-- I think I need
to peer at some examples. If anyone has a good example or two of calling C
code from Racket, I'd be much obliged.

In detail, what I imagine is going to happen is that I will be accessing
some (shared?) object files, created as part of the OpenCV build, by calling
(define function-name (get-ffi-obj function-name (ffi-lib lib-name)
format)...)
I'm not clear, however, on what the particular object files I'm looking up
with ffi-lib. I also am unclear about the convention for the function-name
parameter to get-ffi-obj. Is it as simple as a string of the the name that
the C api is exposing?

I hope I've revealed my ignorance appropriately-- if you noticed any other
misconceptions or egregious gaps, please do let me know!

ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110207/56a11df5/attachment.html>

Posted on the users mailing list.