Android can only run c-shared libraries which means that every
Gio program must create its window and event loop from an init
function.
The same applies to iOS but for a more benign reason: the gio tool
builds programs in c-archive mode for iOS and links the binary with
a Objective-C driver.
Allow Gio programs to run off its main function by linking to and
invoking main even from Android libraries and iOS ditto.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The app data dir is not set until after Go's init functions have
run, which means that DataDir is inherently racy. Avoid that race
by blocking in DataDir until it is set from Java.
In other words, trade a race condition with a deadlock.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The data dir string is returned to Go as a byte array of the UTF-8
encoded string, but it is not NUL terminated.
Signed-off-by: Elias Naur <mail@eliasnaur.com>