From 1545ef083d33df7a6f5b7f59fc411746f0a5768f Mon Sep 17 00:00:00 2001 From: gucio321 Date: Thu, 30 Nov 2023 15:46:12 +0100 Subject: [PATCH] codegen: use export data to CData field fix #231 --- cmd/codegen/arguments_wrapper.go | 2 +- cmd/codegen/gengo_typedefs.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/codegen/arguments_wrapper.go b/cmd/codegen/arguments_wrapper.go index c25b9b867..a52c14ab6 100644 --- a/cmd/codegen/arguments_wrapper.go +++ b/cmd/codegen/arguments_wrapper.go @@ -101,7 +101,7 @@ func getArgWrapper( "const ImWchar*": simpleW("(*Wchar)", "(*C.ImWchar)"), "ImWchar16": simpleW("uint16", "C.ImWchar16"), "void*": simpleW("uintptr", "unsafe.Pointer"), - "const void*": simpleW("unsafe.Pointer", ""), + "const void*": simpleW("uintptr", "unsafe.Pointer"), "const ImVec2": wrappableW("Vec2", "C.ImVec2"), "const ImVec2*": wrappablePtrW("*Vec2", "C.ImVec2"), "ImVec2": wrappableW("Vec2", "C.ImVec2"), diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index ca42fb8e0..6bd84c0e3 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -216,17 +216,17 @@ func (self %[1]s) c() (C.%[2]s, func()) { // we need to make it a struct, because we need to hide C type (otherwise it will duplicate methods) fmt.Fprintf(sb, ` type %[1]s struct { - data *C.%[2]s + CData *C.%[2]s } func (self *%[1]s) handle() (result *C.%[2]s, fin func()) { - return self.data, func() {} + return self.CData, func() {} } %[3]s func new%[1]sFromC(cvalue *C.%[2]s) *%[1]s { - return &%[1]s{data: cvalue} + return &%[1]s{CData: cvalue} } `, name.renameGoIdentifier(), name, toPlainValue) }