mirror of
https://github.com/golang/go
synced 2024-10-05 16:41:21 -06:00
c8aba85e4a
Previously we started the Go runtime from a JNI function call, which eventually called the program's main function. Now the runtime is initialized by an ELF initialization function as a c-shared library, and the program's main function is not called. So now we export main so it can be called from JNI. This is necessary for all-Go apps because unlike a normal shared library, the program loading the library is not written by or known to the programmer. As far as they are concerned, the .so is everything. In fact the same code is compiled for iOS as a normal Go program. Change-Id: I61c6a92243240ed229342362231b1bfc7ca526ba Reviewed-on: https://go-review.googlesource.com/9015 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
16 lines
463 B
Go
16 lines
463 B
Go
// Copyright 2014 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 runtime
|
|
|
|
import _ "unsafe" // for go:cgo_export_static and go:cgo_export_dynamic
|
|
|
|
// Export the main function.
|
|
//
|
|
// Used by the app package to start all-Go Android apps that are
|
|
// loaded via JNI. See golang.org/x/mobile/app.
|
|
|
|
//go:cgo_export_static main.main
|
|
//go:cgo_export_dynamic main.main
|