Hi guys!
Reading the chicken docs on foreign, you'll find:
Structs cannot be directly passed as arguments to foreign functions, nor
can they be result values. (
http://api.call-cc.org/doc/foreign/types#def:struct)
Pointers to structs are supported, but not structs-by-value. I am wondering
if
On Wed, 2012-02-29 at 14:07 +0100, Kristian Lein-Mathisen wrote:
[...]
Reading the chicken docs on foreign, you'll find:
Structs cannot be directly passed as arguments to foreign
functions, nor can they be result values.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 02/29/2012 01:29 PM, Thomas Chust wrote:
Last but not least, passing structures as pointers makes memory
management for them explicit and that is a good thing in this case
because there is simply no way the FFI could automatically figure out
Thanks to both of you for some valuable insight! I didn't realize
de-referencing on the c-side would be that simple, nor that
structs-by-value would actually be pointers anyway.
However, my problem is still not entirely solved. I am trying to interface
to the physics engines Box2D and Chipmunk,
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 02/29/2012 03:18 PM, Kristian Lein-Mathisen wrote:
Since struct-by-value is so central in both of these libraries, manually
writing wrapper-code would take too long. I am unsure of where to go from
here, but I suppose my options are:
- Modify
Kristian Lein-Mathisen kristianl...@gmail.com writes:
Any thoughts on how to pursue this?
Another option would be to create a module which re-exports all
`foreign' syntax wrapped with support for structs-by-value. Then just
import your wrapper module instead of `foreign' in the code generated