summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-11 11:50:45 -0400
committerPietro Gagliardi <[email protected]>2014-07-11 11:50:45 -0400
commit36e8393b46fe3c7ab2b2eaf775c458ed9d4a7735 (patch)
tree718727af67b436fbbc721950dcf98aa0a6c80bd8
parent14913e042e96ba62f0f23e2ccece2c4330d094c7 (diff)
Added an attempt at overriding HWND, etc. in the zwinconstgen.go type generation; will test now.
-rw-r--r--redo/zwinconstgen.go10
1 files changed, 10 insertions, 0 deletions
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 <stdint.h>
{{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"