2
0
mirror of synced 2025-02-23 14:58:12 +00:00
mobile/bind/testdata/issue12328.go.golden
Elias Naur 4600df55ca bind, cmd: generate complete standalone bindings from gobind
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>
2018-03-16 06:47:34 +00:00

54 lines
1.1 KiB
Plaintext

// Package main is an autogenerated binder stub for package issue12328.
// gobind -lang=go issue12328
//
// File is generated by gobind. Do not edit.
package main
/*
#include <stdlib.h>
#include <stdint.h>
#include "seq.h"
#include "issue12328.h"
*/
import "C"
import (
_seq "golang.org/x/mobile/bind/seq"
"issue12328"
)
// suppress the error if seq ends up unused
var _ = _seq.FromRefNum
//export proxyissue12328_T_Err_Set
func proxyissue12328_T_Err_Set(refnum C.int32_t, v C.int32_t) {
ref := _seq.FromRefNum(int32(refnum))
var _v error
_v_ref := _seq.FromRefNum(int32(v))
if _v_ref != nil {
if v < 0 { // go object
_v = _v_ref.Get().(error)
} else { // foreign object
_v = (*proxy_error)(_v_ref)
}
}
ref.Get().(*issue12328.T).Err = _v
}
//export proxyissue12328_T_Err_Get
func proxyissue12328_T_Err_Get(refnum C.int32_t) C.int32_t {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(*issue12328.T).Err
var _v C.int32_t = _seq.NullRefNum
if v != nil {
_v = C.int32_t(_seq.ToRefNum(v))
}
return _v
}
//export new_issue12328_T
func new_issue12328_T() C.int32_t {
return C.int32_t(_seq.ToRefNum(new(issue12328.T)))
}