READ
Created
May 8, 2016 11:49
-
-
Save akkijp/15c00105ae188c76057b45836097ce7d to your computer and use it in GitHub Desktop.
test cgo packages - https://github.com/golang/go/wiki/cgo
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 | |
/* | |
#include <stdio.h> | |
#include <stdlib.h> | |
void mStringPrintln(char* s) { | |
printf("%s\n", s); | |
} | |
*/ | |
import "C" | |
import "unsafe" | |
func main(){ | |
cs := C.CString("Hello from stdio") | |
C.mStringPrintln(cs) | |
C.free(unsafe.Pointer(cs)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment