; So I realized I needed to do foreign-primitive and use C_alloc (according to sjamaan and the docs). ; But my struct is still not stored in a safe place: ; my c-code looks like this: ;struct line foo2 () { ; struct line l; ; l.origin.tag = 11; ; l.origin.x = 12; ; l.origin.y = 13; ; ; l.direction.tag = 14; ; l.direction.x = 15; ; l.direction.y = 16; ; return l; ;} (define make-line (foreign-primitive (c-pointer (struct "line")) () "struct line *_tmp=(struct line*)C_alloc(sizeof(struct line)); *_tmp=foo2(); return(_tmp);")) ; I tried C_return with same results. ; C_malloc seems to work, however!