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

Mikael mikael.rcv at gmail.com
Tue Aug 20 18:45:22 EDT 2013


Hi Chris,

Yes this is a good Q.


2013/8/20 Chris Mueller <ruunsmail at gmail.com>
..

> (define struct-test
>    (c-lambda () struct-test "struct test x; ___result = x;"))


> But if i run the test script with this function, i get a
> segmentation fault immediately.
>
Weird!


> There is also another option which comes in my mind:
>
> (define struct-test
>    (c-lambda () struct-test "struct test x; ___result_voidstar = &x;"))
>
> This is e.g. running the allocation loop. But it will segfault when
> quiting the script with CTRL + X.
>

Weird too!


> But it would be great, if we could clarify later the proper usage of
> structs in the ffi. I've gotten curious about that. :)



Sounds like a good time to ask Marc!


Now just for absolute clarity, can you please paste the total code of your
three different examples (the one leaking and the two sigsegv:ing).

Best regards,
Mikael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20130821/2cfeefd1/attachment.htm>


More information about the Gambit-list mailing list