[plt-scheme] Writing Extensions
Not sure if you've received responses yet, but I can answer a couple of  
your questions.
> 1. How do I return multiple values from a primitive?
http://download.plt-scheme.org/doc/insidemz/insidemz-Z-H- 
6.html#%_sec_6.3
> 2. How do I make sure things are garbage collected when (exit) is  
> called?  The
> databases need to close nicely to sync to the disk and right now they  
> don't.
Look for "void scheme_add_atexit_closer(Scheme_Exit_Closer_Func f)":
http://download.plt-scheme.org/doc/insidemz/insidemz-Z-H- 
14.html#%_chap_14
A thread explaining why GC doesn't get done on exit:
http://www.cs.utah.edu/plt/mailarch/plt-scheme-2002/msg00191.html
Another thread discussing exit behavior:
http://www.cs.utah.edu/plt/mailarch/plt-scheme-2002/msg00218.html
I haven't used this myself, but it looks like you can add a custom exit  
hook to make sure you close your databases, but you can't rely on all  
Scheme objects being finalized.
Dave Herman