[gambit-list] is this a bug in ffi?

Mikael mikael.rcv at gmail.com
Sun Feb 5 13:56:12 EST 2012


2012/2/5 Álvaro Castro-Castilla <alvaro.castro.castilla at gmail.com>

> Hi!
>
> I open a new thread, because this is a deeper issue than the C++ enums
> conversion problem.
>
> When I declare this:
>
> (define CAIRO_FORMAT_RGB24 ((c-lambda () cairo-format-t "___result =
> CAIRO_FORMAT_RGB24;")))
>
> or:
> (define CAIRO_FORMAT_RGB24 (c-lambda () cairo-format-t "___result =
> CAIRO_FORMAT_RGB24;"))
> and then call
> (CAIRO_FORMAT_RGB24)
>
> my program segfaults. It seems that just executing that c-lambda,
> returning an enum, fails. The enum is defined as:  (c-define-type
> cairo-format-t "cairo_format_t")
>

Ouch - your declaration makes Gambit identify, I think, cairo_format_t as a
C structure, and tries to copy its contents fully. Hmm. If this is not how
it really is, do (c-define-type cairo-format-t integer) or sth?

>
> I don't understand why this segfaults: 1) I'm declaring the type 2) I'm
> returning the proper type. What's the problem?
>
>
> Best regards,
>
> Álvaro
>
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120205/e3deba75/attachment.htm>


More information about the Gambit-list mailing list