Skip to content

Commit e0d60aa

Browse files
authored
Merge pull request #106 from gucio321/fix-longlong
extra types: fix C type in plot time
2 parents 8454afc + 21dc7ab commit e0d60aa

File tree

5 files changed

+20
-16
lines changed

5 files changed

+20
-16
lines changed

cimgui_funcs.go

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/codegen/arguments_wrapper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func argWrapper(argType string) (wrapper argumentWrapper, err error) {
3030
"const char* const[]": charPtrPtrW,
3131
"unsigned char": simpleW("uint", "C.uchar"),
3232
"unsigned char**": uCharPtrW,
33-
"size_t": simpleW("uint64", "C.xlong"),
33+
"size_t": simpleW("uint64", "C.xulong"),
3434
"size_t*": sizeTPtrW,
3535
"float": floatW,
3636
"float*": floatPtrW,
@@ -130,7 +130,7 @@ func uCharPtrW(arg ArgDef) ArgumentWrapperData {
130130
func sizeTPtrW(arg ArgDef) ArgumentWrapperData {
131131
return ArgumentWrapperData{
132132
ArgType: "*uint64",
133-
VarName: fmt.Sprintf("(*C.xlong)(%s)", arg.Name),
133+
VarName: fmt.Sprintf("(*C.xulong)(%s)", arg.Name),
134134
}
135135
}
136136

extra_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package imgui
22

33
// #include "cimgui_wrapper.h"
44
// #include "cimplot_wrapper.h"
5+
// #include "extra_types.h"
56
import "C"
7+
68
import (
79
"image/color"
810
"time"
@@ -202,7 +204,7 @@ func (i *PlotTime) fromC(p C.ImPlotTime) *PlotTime {
202204
}
203205

204206
func (p PlotTime) toC() C.ImPlotTime {
205-
return C.ImPlotTime{S: C.long(p.S), Us: C.int(p.Us)}
207+
return C.ImPlotTime{S: C.xlong(p.S), Us: C.int(p.Us)}
206208
}
207209

208210
// wrappableType represents a GO type that can be converted into a C value

extra_types.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#pragma once
22

33
#ifdef __WIN32
4-
typedef unsigned long long xlong;
4+
typedef unsigned long long xulong;
5+
typedef long long xlong;
56
#else
6-
typedef unsigned long xlong;
7+
typedef unsigned long xulong;
8+
typedef long xlong;
79
#endif

input_text.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func InputTextWithHint(label, hint string, buf *string, flags InputTextFlags, ca
7272
labelArg,
7373
hintArg,
7474
(*C.char)(state.buf.ptr),
75-
C.xlong(len(*buf)+1),
75+
C.xulong(len(*buf)+1),
7676
C.ImGuiInputTextFlags(flags),
7777
C.ImGuiInputTextCallback(C.generalInputTextCallback),
7878
unsafe.Pointer(&stateHandle),
@@ -101,7 +101,7 @@ func InputTextMultiline(label string, buf *string, size Vec2, flags InputTextFla
101101
return C.igInputTextMultiline(
102102
labelArg,
103103
(*C.char)(state.buf.ptr),
104-
C.xlong(len(*buf)+1),
104+
C.xulong(len(*buf)+1),
105105
size.toC(),
106106
C.ImGuiInputTextFlags(flags),
107107
C.ImGuiInputTextCallback(C.generalInputTextCallback),

0 commit comments

Comments
 (0)