moonbit-docs
moonbit-docs copied to clipboard
docs: improve FFI `callee-owned calling convention` documentations for calling `closure`
we can bind this C function and pass closure to it using the following trick:
current moonc insert moonbit_incref ouside the closure, but in FFI boundary moonc insert this instruction is impossible.
a possible solutiion is insert this instruction inside the closure BLOCK BEGIN, and then insert moonbit_decref in the closure BLOCK END. like C++ RAII.