github.com/emcfarlane/larking@v0.0.0-20220605172417-1704b45ee6c3/builder/testdata/cgo/main.go (about) 1 package main 2 3 // #include <stdio.h> 4 // #include <stdlib.h> 5 // 6 // static void myprint(char* s) { 7 // printf("%s\n", s); 8 // } 9 import "C" 10 import "unsafe" 11 12 func main() { 13 cs := C.CString("Hello, cgo!") 14 C.myprint(cs) 15 C.free(unsafe.Pointer(cs)) 16 }