From 36e8393b46fe3c7ab2b2eaf775c458ed9d4a7735 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 11 Jul 2014 11:50:45 -0400 Subject: Added an attempt at overriding HWND, etc. in the zwinconstgen.go type generation; will test now. --- redo/zwinconstgen.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/redo/zwinconstgen.go b/redo/zwinconstgen.go index 2a44589..f2db8b1 100644 --- a/redo/zwinconstgen.go +++ b/redo/zwinconstgen.go @@ -92,6 +92,7 @@ import ( "bytes" "reflect" "go/format" + "strings" ) // #define UNICODE // #define _UNICODE @@ -108,7 +109,16 @@ import ( // #include {{range .Consts}}// uintptr_t {{.}} = (uintptr_t) ({{noprefix .}}); {{end}}import "C" +// MinGW will generate handle pointers as pointers to some structure type under some conditions I don't fully understand; here's full overrides +var handleOverrides = []string{ + "HWND", +} func winName(t reflect.Type) string { + for _, s := range handleOverrides { + if strings.Contains(t.Name(), s) { + return "uintptr" + } + } switch t.Kind() { case reflect.UnsafePointer: return "uintptr" -- cgit v1.2.3