Skip to content

Commit

Permalink
codegen: use export data to CData field
Browse files Browse the repository at this point in the history
fix #231
  • Loading branch information
gucio321 committed Nov 30, 2023
1 parent d2f8f71 commit 1545ef0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/codegen/arguments_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
6 changes: 3 additions & 3 deletions cmd/codegen/gengo_typedefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 1545ef0

Please sign in to comment.