Closed gyuro closed 1 day ago
Hi @gyuro -- there are a couple potential issues here:
bar
will be destroyed when foo()
returns due to C++'s RAIIstd::array
; it's possible that this isn't ABI compatible with just returning a pointerProbably best to return a raw pointer (e.g. bar.data()
) and copy it on the Codon side. Does it work if you do this?
IMO, it's more effective to pass the arguments that need to be returned.
Thanks for your feedback!
In C:
In Codon:
In the above scenarios, when running the Codon script, the
bar
value is initially set to null or a dummy value. However, subsequent iterations seem to work fine. I'm not sure what the problem is at this point.Additionally, printing the
bar
variable during the first iteration results in a segmentation fault. It appears this issue is related to the garbage collector (GC) in Codon. This information might be useful for debugging.Any comments would be welcomed.