chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] foreign: Why is passing structs as arguments and ret


From: Kristian Lein-Mathisen
Subject: Re: [Chicken-users] foreign: Why is passing structs as arguments and return-types not supported?
Date: Mon, 5 Mar 2012 00:52:53 +0100


Hi guys,

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!
K.

On Wed, Feb 29, 2012 at 5:44 PM, Moritz Heidkamp <address@hidden> wrote:
Kristian Lein-Mathisen <address@hidden> 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 by
`chicken-bind'.

Moritz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]