2
0
mirror of synced 2025-02-23 14:58:12 +00:00
mobile/bind/seq.go.support
Elias Naur 7cb2b86de7 mobile/bind: allow Num function in bound interfaces
Rename the refnum field, Num,  to something much less likely to clash
with an interface method set.

Change-Id: If334966b2430f38118baded44461bd39298bafb0
Reviewed-on: https://go-review.googlesource.com/20983
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-03-21 23:26:23 +00:00

37 lines
744 B
Plaintext

// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gomobile_bind
// Go support functions for generated Go bindings. This file is
// copied into the generated package, gomobile_bind, and compiled
// along with the bindings.
// #include <stdlib.h>
// #include "seq.h"
import "C"
import (
"errors"
"fmt"
_seq "golang.org/x/mobile/bind/seq"
)
func toError(s string) error {
if s == "" {
return nil
}
return errors.New(s)
}
func init() {
_seq.FinalizeRef = func(ref *_seq.Ref) {
if ref.Bind_Num < 0 {
panic(fmt.Sprintf("not a foreign ref: %d", ref.Bind_Num))
}
C.go_seq_dec_ref(C.int32_t(ref.Bind_Num))
}
}