[racket] ffi/unsafe examples

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Feb 7 14:03:49 EST 2011

The ffi has a directory of examples:


and there are many on PLaneT


2011/2/7 Ben Dean <benjamin.dean at aya.yale.edu>:
> 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
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.