Added an attempt at overriding HWND, etc. in the zwinconstgen.go type generation; will test now.

This commit is contained in:
Pietro Gagliardi 2014-07-11 11:50:45 -04:00
parent 14913e042e
commit 36e8393b46
1 changed files with 10 additions and 0 deletions

View File

@ -92,6 +92,7 @@ import (
"bytes" "bytes"
"reflect" "reflect"
"go/format" "go/format"
"strings"
) )
// #define UNICODE // #define UNICODE
// #define _UNICODE // #define _UNICODE
@ -108,7 +109,16 @@ import (
// #include <stdint.h> // #include <stdint.h>
{{range .Consts}}// uintptr_t {{.}} = (uintptr_t) ({{noprefix .}}); {{range .Consts}}// uintptr_t {{.}} = (uintptr_t) ({{noprefix .}});
{{end}}import "C" {{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 { func winName(t reflect.Type) string {
for _, s := range handleOverrides {
if strings.Contains(t.Name(), s) {
return "uintptr"
}
}
switch t.Kind() { switch t.Kind() {
case reflect.UnsafePointer: case reflect.UnsafePointer:
return "uintptr" return "uintptr"