Open xlc opened 2 months ago
You can pass a pointer to a preallocated chunk of memory and then have the host function write to it. Alternatively if the size of the data is not known you could do it in two steps - first query the host how much memory is needed, have the guest allocate it, and then have the host write to it.
On the guest side there's the derive macro which can be used to define custom marshaling strategies for custom types (e.g. see here for an example.)
thanks. will give it a play and see if I can something working
any plan to update polkavm_import/export macro to support advanced argument passing? or it will stick with registers and then in that case we need another library to abstract the argument marshalling work
Depends on what exactly you mean by "advanced argument passing", but in general at least in the short term I'm not planing on expanding its capabilities beyond the basics and concentrate on making the fundamentals really solid.
Looks like currently only a few numeric types are supported and the ABI is simply pass the arguments via register. This means we can only pass small arguments by value. How can we pass large objects? Or a string or just bunch of bytes?