[gambit-list] vectors and C pointers

Jeremie Lasalle Ratelle pouexmachinax at gmail.com
Wed Oct 28 14:58:56 EDT 2009


I don't think these macros are documented.

You can just use the ___BODY macro. It will give you a ___WORD*
pointer to the body of any subtyped scheme object.

As for having a scheme object body allocated with malloc, I think it
would probably behave badly with the garbage collector.

If you want to allocate a scheme object in c, check the
___alloc_scmobj in lib/mem.c
As an example let's check what the ##make-vector function does in
lib/_kernel.scm

___SCMOBJ result = ___alloc_scmobj (___sVECTOR, n<<___LWS, ___STILL);

I'm showing you how it allocates the still object as it is the simplest case.



More information about the Gambit-list mailing list