Open o-simon opened 9 years ago
It's doable, not sure how quickly though. ;) Basically, it just requires wrapping libffi and generating calls to that rather than "normal". I'll look into this and update.
Thank you very much!
If there's a workaround I could use for the meantime, please let me know.
cffi itself has some support for struct by value, but it might be the case that autowrap skips the layer of cffi that would handle that...? sorry, that's all i know.
That's correct; CFFI wraps libffi for calls, but this would mean interfacing with its higher-level struct definition etc which autowrap more or less entirely ignores (for various reasons). Actually implementing this shouldn't be hard: autowrap can autowrap it. I'm just in the middle of another project at the moment unfortunately.
This is finally more-or-less implemented in the libffi branch. You need to load cl-autowrap/libffi
. This can be used as a sole dependency or loaded after the fact.
Currently:
(free VALUE)
returned by a value-return call. This does not include scalar values (or won't shortly).Some other caveats:
buildkit
will be the solution to that
I'm trying to autowrap Chipmunk2D, a C library for 2D physics simulation: https://github.com/slembcke/Chipmunk2D
Many functions return and receive by value a structure that represents a 2D vector (cpVect if you are interested).
In the FAQs you mention to let you know if passing structs by value is necessary so you can prioritize this issue :D
What do you think? Is it doable?
Thank you!