Hi,<div><br></div><div>I'm using my ffi cairo bindings, that worked fine in the past. However now that I'm using Gambit compiled with C++ support it stopped working.</div><div><br></div><div><br></div><div><br></div>

<div><br></div><div>I got this error:</div><div><div><br></div><div>*** ERROR IN main-sdl#main, "main-sdl.scm"@19.24 -- (Argument 2) Can't convert to C type</div><div>(cairo#cairo-image-surface-create-for-data '#<|unsigned char*| #16 0x7f33ba191000> 1 500 500 2000)</div>

</div><div><br></div><div>On the ffi side, things are declared like this:</div><div><br></div><div><div>(c-define-type cairo-format-t "cairo_format_t")</div><div>(define CAIRO_FORMAT_ARGB32 0)</div><div>(define CAIRO_FORMAT_RGB24 1)</div>

<div>(define CAIRO_FORMAT_A8 2)</div><div>(define CAIRO_FORMAT_A1 3)</div><div>(define CAIRO_FORMAT_RGB16_565 4)</div></div><div>(define cairo-image-surface-create-for-data (c-lambda (unsigned-char* cairo-format-t int int int) cairo-surface-t* "cairo_image_surface_create_for_data"))</div>

<div><br></div><div>And used like this:</div><div><br></div><div><div>(cairo-image-surface-create-for-data</div><div>                         (SDL::surface-pixels sdl-surface)</div><div>                         CAIRO_FORMAT_RGB24</div>

<div>                         maxx</div><div>                         maxy</div><div>                         (SDL::screen-pitch sdl-surface))</div></div><div><br></div><div>I've tried with this idea:</div><div><br></div>

<div><div>(define cairo-format</div><div>  (c-lambda (int) cairo-format-t</div><div>            "</div><div>            switch (___arg1) {</div><div>              case 0: ___result = CAIRO_FORMAT_ARGB32; break;</div>

<div>              case 1: ___result = CAIRO_FORMAT_RGB24; break; // and so on...</div><div>            }</div><div>            "))</div></div><div><br></div><div>And then calling on the Scheme side "(cairo-format CAIRO_FORMAT_RGB24)" instead of just using the int directly, but it segfaults.</div>

<div><br></div><div><br></div><div>How should I really handle enums properly?</div><div><br></div><div><br></div><div><br></div><div>Best regards,</div><div><br></div>