diff --git a/bind/gen_map.go b/bind/gen_map.go index 27c1d86..2803438 100644 --- a/bind/gen_map.go +++ b/bind/gen_map.go @@ -303,7 +303,14 @@ otherwise parameter is a python list that we copy from g.gofile.Outdent() g.gofile.Printf("}\n") if esym.go2py != "" { - g.gofile.Printf("return %s(v)%s\n", esym.go2py, esym.go2pyParenEx) + // If the go2py starts with handleFromPtr_, use &v, otherwise just v + val_str := "" + if strings.HasPrefix(esym.go2py, "handleFromPtr_") { + val_str = "&v" + } else { + val_str = "v" + } + g.gofile.Printf("return %s(%s)%s\n", esym.go2py, val_str, esym.go2pyParenEx) } else { g.gofile.Printf("return v\n") }