Skip to content

Instantly share code, notes, and snippets.

@tenntenn
Last active June 18, 2016 09:02
Show Gist options
  • Save tenntenn/b6e4a8873ac247fc5364 to your computer and use it in GitHub Desktop.
Save tenntenn/b6e4a8873ac247fc5364 to your computer and use it in GitHub Desktop.
$ CGO_ENABLED=1\
CC=arm-linux-androideabi-gcc\
GOOS=android\
GOARCH=arm\
GOARM=7\
go buid -build-mode=pie hellocgo.go
package main
import "unsafe"
/*
#include <stdio.h>
#include <stdlib.h>
void hello(char *s) {
printf("Hello, %s\n", s);
}
*/
import "C"
func main() {
str := C.CString("Droid Kaigi")
C.hello(str)
C.free(unsafe.Pointer(str))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment