The gobind and gomobile bind tools have historically overlapped: gobind outputs generated bindings, and gomobile bind will generate bindings before building them. However, the gobind bindings were never used for building and thus allowed to not be complete. To simplify version control, debugging, instrumentation and build system flexibility, this CL upgrades the gobind tool to be the canonical binding generator and change gomobile bind to use gobind instead of its own generator code. This greatly simplifies gomobile bind, but also paves the way to skip gomobile bind entirely. For example: $ gobind -outdir=$GOPATH golang.org/x/mobile/example/bind/hello $ GOOS=android GOARCH=arm64 CC=<ndk-toolchain>/bin/clang go build -buildmode=c-shared -o libgobind.so gobind $ ls libgobind.* libgobind.h libgobind.so The same applies to iOS, although the go build command line is more involved. By skipping gomobile it is possible to freely customize the Android or iOS SDK level or any other flags not supported by gomobile bind. By checking in the generated source code, the cost of supporting gomobile in a custom build system is also decreased. Change-Id: I59c14a77d625ac1377c23b3213672e0d83a48c85 Reviewed-on: https://go-review.googlesource.com/99316 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
209 lines
3.7 KiB
Plaintext
209 lines
3.7 KiB
Plaintext
// Package main is an autogenerated binder stub for package vars.
|
|
// gobind -lang=go vars
|
|
//
|
|
// File is generated by gobind. Do not edit.
|
|
package main
|
|
|
|
/*
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include "seq.h"
|
|
#include "vars.h"
|
|
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
_seq "golang.org/x/mobile/bind/seq"
|
|
"vars"
|
|
)
|
|
|
|
// suppress the error if seq ends up unused
|
|
var _ = _seq.FromRefNum
|
|
|
|
//export new_vars_S
|
|
func new_vars_S() C.int32_t {
|
|
return C.int32_t(_seq.ToRefNum(new(vars.S)))
|
|
}
|
|
|
|
type proxyvars_I _seq.Ref
|
|
|
|
func (p *proxyvars_I) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
|
|
|
|
//export var_setvars_ABool
|
|
func var_setvars_ABool(v C.char) {
|
|
_v := v != 0
|
|
vars.ABool = _v
|
|
}
|
|
|
|
//export var_getvars_ABool
|
|
func var_getvars_ABool() C.char {
|
|
v := vars.ABool
|
|
var _v C.char = 0
|
|
if v {
|
|
_v = 1
|
|
}
|
|
return _v
|
|
}
|
|
|
|
//export var_setvars_AFloat
|
|
func var_setvars_AFloat(v C.double) {
|
|
_v := float64(v)
|
|
vars.AFloat = _v
|
|
}
|
|
|
|
//export var_getvars_AFloat
|
|
func var_getvars_AFloat() C.double {
|
|
v := vars.AFloat
|
|
_v := C.double(v)
|
|
return _v
|
|
}
|
|
|
|
//export var_setvars_AFloat32
|
|
func var_setvars_AFloat32(v C.float) {
|
|
_v := float32(v)
|
|
vars.AFloat32 = _v
|
|
}
|
|
|
|
//export var_getvars_AFloat32
|
|
func var_getvars_AFloat32() C.float {
|
|
v := vars.AFloat32
|
|
_v := C.float(v)
|
|
return _v
|
|
}
|
|
|
|
//export var_setvars_AFloat64
|
|
func var_setvars_AFloat64(v C.double) {
|
|
_v := float64(v)
|
|
vars.AFloat64 = _v
|
|
}
|
|
|
|
//export var_getvars_AFloat64
|
|
func var_getvars_AFloat64() C.double {
|
|
v := vars.AFloat64
|
|
_v := C.double(v)
|
|
return _v
|
|
}
|
|
|
|
//export var_setvars_AString
|
|
func var_setvars_AString(v C.nstring) {
|
|
_v := decodeString(v)
|
|
vars.AString = _v
|
|
}
|
|
|
|
//export var_getvars_AString
|
|
func var_getvars_AString() C.nstring {
|
|
v := vars.AString
|
|
_v := encodeString(v)
|
|
return _v
|
|
}
|
|
|
|
//export var_setvars_AStructPtr
|
|
func var_setvars_AStructPtr(v C.int32_t) {
|
|
// Must be a Go object
|
|
var _v *vars.S
|
|
if _v_ref := _seq.FromRefNum(int32(v)); _v_ref != nil {
|
|
_v = _v_ref.Get().(*vars.S)
|
|
}
|
|
vars.AStructPtr = _v
|
|
}
|
|
|
|
//export var_getvars_AStructPtr
|
|
func var_getvars_AStructPtr() C.int32_t {
|
|
v := vars.AStructPtr
|
|
var _v C.int32_t = _seq.NullRefNum
|
|
if v != nil {
|
|
_v = C.int32_t(_seq.ToRefNum(v))
|
|
}
|
|
return _v
|
|
}
|
|
|
|
//export var_setvars_AnInt
|
|
func var_setvars_AnInt(v C.nint) {
|
|
_v := int(v)
|
|
vars.AnInt = _v
|
|
}
|
|
|
|
//export var_getvars_AnInt
|
|
func var_getvars_AnInt() C.nint {
|
|
v := vars.AnInt
|
|
_v := C.nint(v)
|
|
return _v
|
|
}
|
|
|
|
//export var_setvars_AnInt16
|
|
func var_setvars_AnInt16(v C.int16_t) {
|
|
_v := int16(v)
|
|
vars.AnInt16 = _v
|
|
}
|
|
|
|
//export var_getvars_AnInt16
|
|
func var_getvars_AnInt16() C.int16_t {
|
|
v := vars.AnInt16
|
|
_v := C.int16_t(v)
|
|
return _v
|
|
}
|
|
|
|
//export var_setvars_AnInt32
|
|
func var_setvars_AnInt32(v C.int32_t) {
|
|
_v := int32(v)
|
|
vars.AnInt32 = _v
|
|
}
|
|
|
|
//export var_getvars_AnInt32
|
|
func var_getvars_AnInt32() C.int32_t {
|
|
v := vars.AnInt32
|
|
_v := C.int32_t(v)
|
|
return _v
|
|
}
|
|
|
|
//export var_setvars_AnInt64
|
|
func var_setvars_AnInt64(v C.int64_t) {
|
|
_v := int64(v)
|
|
vars.AnInt64 = _v
|
|
}
|
|
|
|
//export var_getvars_AnInt64
|
|
func var_getvars_AnInt64() C.int64_t {
|
|
v := vars.AnInt64
|
|
_v := C.int64_t(v)
|
|
return _v
|
|
}
|
|
|
|
//export var_setvars_AnInt8
|
|
func var_setvars_AnInt8(v C.int8_t) {
|
|
_v := int8(v)
|
|
vars.AnInt8 = _v
|
|
}
|
|
|
|
//export var_getvars_AnInt8
|
|
func var_getvars_AnInt8() C.int8_t {
|
|
v := vars.AnInt8
|
|
_v := C.int8_t(v)
|
|
return _v
|
|
}
|
|
|
|
//export var_setvars_AnInterface
|
|
func var_setvars_AnInterface(v C.int32_t) {
|
|
var _v vars.I
|
|
_v_ref := _seq.FromRefNum(int32(v))
|
|
if _v_ref != nil {
|
|
if v < 0 { // go object
|
|
_v = _v_ref.Get().(vars.I)
|
|
} else { // foreign object
|
|
_v = (*proxyvars_I)(_v_ref)
|
|
}
|
|
}
|
|
vars.AnInterface = _v
|
|
}
|
|
|
|
//export var_getvars_AnInterface
|
|
func var_getvars_AnInterface() C.int32_t {
|
|
v := vars.AnInterface
|
|
var _v C.int32_t = _seq.NullRefNum
|
|
if v != nil {
|
|
_v = C.int32_t(_seq.ToRefNum(v))
|
|
}
|
|
return _v
|
|
}
|