Last active
June 18, 2016 09:02
-
-
Save tenntenn/b6e4a8873ac247fc5364 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ CGO_ENABLED=1\ | |
CC=arm-linux-androideabi-gcc\ | |
GOOS=android\ | |
GOARCH=arm\ | |
GOARM=7\ | |
go buid -build-mode=pie hellocgo.go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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