[racket] Sending a cvector to foreign functions.

From: Lewis (lewis1711 at gmail.com)
Date: Tue Jan 25 09:13:36 EST 2011

Interesting, catches it at compile-time now. Though I can make neither
head nor tail of the error..

compile: access from an uncertified context to unexported variable
from module: "/usr/lib/racket/collects/ffi/unsafe/cvector.rkt" in:
_cvector*

 === context ===
/usr/lib/racket/collects/ffi/unsafe.rkt:271:4: loop
/usr/lib/racket/collects/ffi/unsafe.rkt:320:2
/usr/lib/racket/collects/ffi/unsafe.rkt:513:2
/usr/lib/racket/collects/racket/private/map.rkt:18:11: map
/usr/lib/racket/collects/ffi/unsafe.rkt:557:2: do-fun
/usr/lib/racket/collects/racket/private/map.rkt:45:11: for-each
/usr/lib/racket/collects/compiler/embed-unit.rkt:788:4: do-write-module-bundle

On 26/01/2011, Noel Welsh <noelwelsh at gmail.com> wrote:
> Your code looks correct to me. Things you might try:
>
> - Check tiles are constructed correctly
> - Replace _cvector with (_cvector i _tile) for increased error checking
>
> Sorry I can't be more helpful. These problems are really hard to debug
> as the errors could be in so many places.
>
> N.
>
> On Tue, Jan 25, 2011 at 7:07 AM, Lewis <lewis1711 at gmail.com> wrote:
>> Right you are Noel it turns out the C code had a few bugs of its own.
>> I have independently tested it now, and all is working fine from
>> there.
>>
>> The C prototype is now
>>
>> void render(int x_camera, int y_camera, Visual pc, Tile* world);
>>
>> However I still get the error.
>>
>> http://paste.pocoo.org/show/326448/
>>
>> Here are the relevant bits of racket code, including the error. I
>> would much appreciate if anyone could tell me if I am doing something
>> obviously wrong.
>>
>> The main ithing I am confused about is... *how do I send a information
>> from racket to a C function that expects an array*
>>
>> Thanks,
>> Lewis
>


Posted on the users mailing list.