> From: Peter Feigl <cra...@gmx.net> > Date: Wed, 12 Dec 2012 20:26:31 +0100 > > [...] > > I've been playing around with the shim C code, is there a way I can > create an alien that contains a struct?
No. Aliens are extra-heap pointers. You CAN create an alien containing the memory address of a struct -- a pointer to a struct. The address should be outside the heap, in memory that you or your library allocated. > Then it should be possible to support structs as return and > parameter types. There are multitudinous ways to support structs as return and parameter types, all of them sad and boring. > Are aliens garbage-collected automatically? Sometimes. > Can I just malloc some memory for an alien, then cons_alien it, then > expect it to be garbage-collected later? Nope. You CAN use the Scheme procedure malloc to allocate some memory that will be free()d if the returned alien is ever garbage collected. (This is in the manual, yes?) cons_alien is a callback trampoline utility. It will occasionally abort. The shim callback code is prepared to re-start after a GC abort, so... don't "play around" with the shim code (unless you understand what I just wrote). _______________________________________________ MIT-Scheme-devel mailing list MIT-Scheme-devel@gnu.org https://lists.gnu.org/mailman/listinfo/mit-scheme-devel