You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a test for taking a CPtr pointer of a struct (dataclass) from Python #1787
This would do a call to C function my_allocate which further calls malloc and then returns a pointer which gets assigned to sptr.
s: S=S()
s.k=5sptr: CPtr=p_c_pointer(s)
Here S gets created using alloca LLVM instruction then it is bit casted to void* and finally assigned to sptr.
@certik I think the first one already works. If you think the second one that is creating struct using LLVM's alloca is correct behaviour then I will go ahead with that.
Activity
certik commentedon May 11, 2023
Currently the only way seems to be to allocate the memory in C and then use as follows:
But we would like something like:
czgdp1807 commentedon May 16, 2023
Note the differences.
This would do a call to C function
my_allocatewhich further callsmallocand then returns a pointer which gets assigned tosptr.Here
Sgets created usingallocaLLVM instruction then it is bit casted tovoid*and finally assigned tosptr.@certik I think the first one already works. If you think the second one that is creating struct using LLVM's
allocais correct behaviour then I will go ahead with that.