Go SDL2 example running on Android

Golang example is compiled to C shared library and then linked with the help of Android.mk files from SDL2.

SDLActivity.java is used, same as with C/C++ and SDL2.

1 Like

I’m new here, how did you compile the go source code into C shared library?

There is a make.bash file where you can see how it is compiled for android, but basically all that is needed is this:
go build -buildmode=c-shared

There is also c-archive mode (static) but that doesn’t work when compiled for GOOS=android.

When you name c shared you mean .dll? .so?

Yes, shared library.

1 Like

Build scripts are now greatly improved. There is also support for gradle, experimental version, so you can import project in Android Studio and use CPU monitor, debugger etc. Intellij will ask to install Go plugin as soon as you open any .go file.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.