game.scm:
(declare (unit game))
(define-external (callin (scheme-object xyz)) void
(print "This is 'callin': " xyz))
main.c:
extern void callin(C_word x);
void callout(int x, int y, int z)
{
C_word *ptr = C_alloc(C_SIZEOF_LIST(3));
C_word lst;
printf("This is 'callout': %d, %d, %d\n", x, y, z);
lst = C_list(&ptr, 3, C_fix(x), C_fix(y), C_fix(z));
callin(lst); /* Note: `callin' will have GC'd the data in `ptr' */
}
После вызова callout(1,3,9) выдает
This is 'callout': 1, 3, 9
Ошибка сегментации(core dumped)
Форум —
Development

