From c40d9f54a22a5653532fb8430e464ce316ad0789 Mon Sep 17 00:00:00 2001 From: visualfc Date: Mon, 18 Nov 2024 11:35:57 +0800 Subject: [PATCH] internal/lib/reflect: value.call support multi ret --- internal/lib/reflect/value.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/lib/reflect/value.go b/internal/lib/reflect/value.go index 260f2938..9df478ca 100644 --- a/internal/lib/reflect/value.go +++ b/internal/lib/reflect/value.go @@ -2044,9 +2044,7 @@ func toFFIArg(v Value, typ *abi.Type) unsafe.Pointer { } else { return unsafe.Pointer(&v.ptr) } - case abi.Complex64: - //TODO - case abi.Complex128: + case abi.Complex64, abi.Complex128: return unsafe.Pointer(v.ptr) case abi.Array: if v.flag&flagIndir != 0 { @@ -2210,7 +2208,12 @@ func (v Value) call(op string, in []Value) (out []Value) { case 1: return []Value{NewAt(toType(tout[0]), ret).Elem()} default: - panic("TODO multi ret") + out = make([]Value, n) + var off uintptr + for i, tout := range tout { + out[i] = NewAt(toType(tout), add(ret, off, "")).Elem() + off += tout.Size() + } } return }