[gambit-list] FFI Converting std::vector to scheme-vector (best practice)

Mikael mikael.rcv at gmail.com
Fri Aug 16 11:25:14 EDT 2013


Hi Chris, super. Feel free to publish it when it's going.

 Is it also possible to accomplish the same directly from a c-lambda that
> returns a scheme-object?
>

Yes, however then for stability you need to sugar *all* Scheme object
allocations you do in C with heap overflow handling logics.

Also a route would be you made a c-define that you have a C enumeration
loop that reports to and the invoked Scheme code does the allocation. For
stability you'd need to ensure other threads don't take over execution and
rewind another C frame, and that you do by stopping Gambit's scheduler, and
also if there'd be a heap overflow or other exception, that needs to be
handled in such a way that your C enumeration loop's stack frame is rewound
properly, so unless needed you don't want to take this route.

So I'd say as long as you feel it's viable to go with the form you are with
now, that is the best option.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20130816/919aa38c/attachment.htm>


More information about the Gambit-list mailing list