func main() { cs := C.CString("Hello from stdio\n") C.myprint(cs) C.free(unsafe.Pointer(cs)) }
func main() { cp() cs := C.CString("Hello from stdio\n") C.myprint(cs) // fmt.Printf("main") }
func Foo() { var cs *C.char = C.CString("Hello, world!\n") C.myprint(cs) C.free(unsafe.Pointer(cs)) }
func Print(s string) { cs := C.CString(s) defer C.free(unsafe.Pointer(cs)) C.myprint(cs) }