[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] foreign: Why is passing structs as arguments and ret
Re: [Chicken-users] foreign: Why is passing structs as arguments and return-types not supported?
Mon, 5 Mar 2012 00:52:53 +0100
I'd like to give a short status-update on the issue. Based on the feedback on this thread and #chicken, the original plan was to patch up chicken-core to support struct-by-val argument- and return-type passing.
This turned out to be very complex indeed. It's unclear of how to represent these structs on the scheme-side. The easiest solution would be to represent the struct with a blob. One problem here though is that it can't be used on the scheme-side itself. This would give the struct-by-value feature questionable usefulness.
On the other hand, the ideal struct representation on the scheme-side should be some sort of record with slots corresponding to the struct fields. That in turn requires giving the struct definition to chicken, where the blob would otherwise only need the size. This involves complexity levels I cannot pinpoint, but it's probably the reason this feature isn't there in the first place!
I am therefore going to give plan B an attempt: modify chicken-bind instead of chicken-core, and let it generate foreign struct-by-value wrappers.
Wish me luck fellas, and thanks for everyone's support on #chicken!
On Wed, Feb 29, 2012 at 5:44 PM, Moritz Heidkamp <address@hidden>
Another option would be to create a module which re-exports all
Kristian Lein-Mathisen <address@hidden
> Any thoughts on how to pursue this?
`foreign' syntax wrapped with support for structs-by-value. Then just
import your wrapper module instead of `foreign' in the code generated by
|[Prev in Thread]
||[Next in Thread]|
- Re: [Chicken-users] foreign: Why is passing structs as arguments and return-types not supported?,
Kristian Lein-Mathisen <=