gforth
[Top][All Lists]
Advanced

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

Re: Precisions on the forth SWIG architecture: return by value structs


From: Bernd Paysan
Subject: Re: Precisions on the forth SWIG architecture: return by value structs
Date: Wed, 14 Jun 2023 03:46:52 +0200

Am Dienstag, 13. Juni 2023, 02:17:43 CEST schrieb Bernd Paysan:
> I suggest this change here, then the type information is available and I can
> deal with it from libcc.fs.

If you want to try this, my fork of Gerald's swig code contains now all 
necessary code to handle struct outputs,

https://github.com/forthy42/swig/

and Gforth git head's libcc.fs knows how to deal with it (as usual, a Debian 
distribution will arrive on Thursday).

The stack effect of a C function returning a struct is then

( ptr param1 .. param_n -- )

assigning the stuct to ptr.  Typical use

{ | buf[ struct-size ] }
buf[ param1 .. param_n function

What's missing is the code to adjust the stack effect for these C bindings.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
net2o id: kQusJzA;7*?t=uy@X}1GWr!+0qqp_Cn176t4(dQ*
https://net2o.de/

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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