mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 15:45:38 +00:00
060ae1cdf9
They're automatically added by Go 1.17 source formatters. This change adds them all now. Signed-off-by: Elias Naur <mail@eliasnaur.com>
31 lines
685 B
Go
31 lines
685 B
Go
// SPDX-License-Identifier: Unlicense OR MIT
|
|
|
|
//go:build android || (darwin && ios)
|
|
// +build android darwin,ios
|
|
|
|
package wm
|
|
|
|
// Android only supports non-Java programs as c-shared libraries.
|
|
// Unfortunately, Go does not run a program's main function in
|
|
// library mode. To make Gio programs simpler and uniform, we'll
|
|
// link to the main function here and call it from Java.
|
|
|
|
import (
|
|
"sync"
|
|
_ "unsafe" // for go:linkname
|
|
)
|
|
|
|
//go:linkname mainMain main.main
|
|
func mainMain()
|
|
|
|
var runMainOnce sync.Once
|
|
|
|
func runMain() {
|
|
runMainOnce.Do(func() {
|
|
// Indirect call, since the linker does not know the address of main when
|
|
// laying down this package.
|
|
fn := mainMain
|
|
fn()
|
|
})
|
|
}
|