@@ -11,7 +11,7 @@ generated and automatically packaged for Android or iOS by
1111`gomobile bind`. For more details on installing and using the gomobile
1212tool, see https://golang.org/x/mobile/cmd/gomobile.
1313
14- Binding Go
14+ # Binding Go
1515
1616Gobind generates target language (Java or Objective-C) bindings for
1717each exported symbol in a Go package. The Go package you choose to
@@ -24,7 +24,7 @@ package can then be _ imported into a Go program, typically built
2424with -buildmode=c-archive for iOS or -buildmode=c-shared for Android.
2525These details are handled by the `gomobile bind` command.
2626
27- Passing Go objects to target languages
27+ # Passing Go objects to target languages
2828
2929Consider a type for counting:
3030
@@ -85,7 +85,7 @@ The equivalent of calling newCounter in Go is GoMypkgNewCounter in Objective-C.
8585The returned GoMypkgCounter* holds a reference to an underlying Go
8686*Counter.
8787
88- Passing target language objects to Go
88+ # Passing target language objects to Go
8989
9090For a Go interface:
9191
@@ -125,7 +125,6 @@ The Java implementation can be used like so:
125125 Printer printer = new SysPrint();
126126 Myfmt.printHello(printer);
127127
128-
129128For Objective-C binding, gobind generates a protocol that declares
130129methods corresponding to Go interface's methods.
131130
@@ -154,32 +153,31 @@ The Objective-C implementation can be used like so:
154153 SysPrint* printer = [[SysPrint alloc] init];
155154 GoMyfmtPrintHello(printer);
156155
157-
158- Type restrictions
156+ # Type restrictions
159157
160158At present, only a subset of Go types are supported.
161159
162160All exported symbols in the package must have types that are supported.
163161Supported types include:
164162
165- - Signed integer and floating point types.
163+ - Signed integer and floating point types.
166164
167- - String and boolean types.
165+ - String and boolean types.
168166
169- - Byte slice types. Note that byte slices are passed by reference,
170- and support mutation.
167+ - Byte slice types. Note that byte slices are passed by reference,
168+ and support mutation.
171169
172- - Any function type all of whose parameters and results have
173- supported types. Functions must return either no results,
174- one result, or two results where the type of the second is
175- the built-in 'error' type.
170+ - Any function type all of whose parameters and results have
171+ supported types. Functions must return either no results,
172+ one result, or two results where the type of the second is
173+ the built-in 'error' type.
176174
177- - Any interface type, all of whose exported methods have
178- supported function types.
175+ - Any interface type, all of whose exported methods have
176+ supported function types.
179177
180- - Any struct type, all of whose exported methods have
181- supported function types and all of whose exported fields
182- have supported types.
178+ - Any struct type, all of whose exported methods have
179+ supported function types and all of whose exported fields
180+ have supported types.
183181
184182Unexported symbols have no effect on the cross-language interface, and
185183as such are not restricted.
@@ -190,8 +188,7 @@ Go types, but this is a work in progress.
190188Exceptions and panics are not yet supported. If either pass a language
191189boundary, the program will exit.
192190
193-
194- Reverse bindings
191+ # Reverse bindings
195192
196193Gobind also supports accessing API from Java or Objective C from Go.
197194Similar to how Cgo supports the magic "C" import, gobind recognizes
@@ -225,7 +222,7 @@ For more details on binding the the native API, see the design proposals,
225222https://golang.org/issues/16876 (Java) and https://golang.org/issues/17102
226223(Objective C).
227224
228- Avoid reference cycles
225+ # Avoid reference cycles
229226
230227The language bindings maintain a reference to each object that has been
231228proxied. When a proxy object becomes unreachable, its finalizer reports
@@ -246,7 +243,7 @@ We recommend that implementations of foreign interfaces do not hold
246243references to proxies of objects. That is: if you implement a Go
247244interface in Java, do not store an instance of Seq.Object inside it.
248245
249- Further reading
246+ # Further reading
250247
251248Examples can be found in http://golang.org/x/mobile/example.
252249
0 commit comments