From 8032dc8456e38f89d8f040cd07532b487055971b Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 25 Aug 2024 12:49:43 +1200 Subject: [PATCH] genbindings: fixes for QApplication ctor's argc/argv handling --- cmd/genbindings/emitgo.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/genbindings/emitgo.go b/cmd/genbindings/emitgo.go index e3cd0dcd..59921c42 100644 --- a/cmd/genbindings/emitgo.go +++ b/cmd/genbindings/emitgo.go @@ -137,6 +137,7 @@ func emitParametersGo(params []CppParameter) string { } else if skipNext { // Skip this parameter, already handled + skipNext = false } else { // Ordinary parameter @@ -170,10 +171,10 @@ func (gfs *goFileState) emitParametersGo2CABIForwarding(m CppMethod) (preamble s preamble += "// Convert []string to long-lived int& argc, char** argv, never call free()\n" preamble += "argc := (*C.int)(C.malloc(8))\n" - preamble += "*argc = len(args)\n" - preamble += "argv := (*[0xffff]*C.char)(C.malloc(c.ulong(8 * len(args))))\n" + preamble += "*argc = C.int(len(args))\n" + preamble += "argv := (*[0xffff]*C.char)(C.malloc(C.ulong(8 * len(args))))\n" preamble += "for i := range args {\n" - preamble += "argv[i] = C.CString(" + p.ParameterName + "[i])\n" + preamble += "argv[i] = C.CString(args[i])\n" preamble += "}\n" tmp = append(tmp, "argc, argv")