OK dumb question time again:  I'm trying to return a pair of fixnums
from a C function.

C_word g2d_glyphs_baseline(struct G2dGlyphs* glyphs)
{
        C_word* a = C_alloc(C_SIZEOF_PAIR + 8);
        C_return(C_pair (&a, C_int_to_num(&a, 10), C_int_to_num(&a, 256)));
}

or maybe

C_word g2d_glyphs_baseline(struct G2dGlyphs* glyphs)
{
        C_word* c_ret = C_alloc(C_SIZEOF_PAIR);
        C_word* a = c_ret;
        C_int_to_num(&a, 10);
        C_int_to_num(&a, 256);
        C_return(*c_ret);
}

to be called like this

( (foreign-lambda scheme-object "g2d_glyphs_baseline" g2d-glyph-vector) glyphs)

It compiles and I get weird results at runtime, so obviously am not
building the cons cell correctly.


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to