1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-24 04:22:22 +00:00
2018-01-04 17:41:51 +08:00

23 lines
280 B
Go

package main
/*
#include <stdio.h>
void cgoPuts(char* s);
static void SayHello(const char* s) {
cgoPuts((char*)(s));
}
*/
import "C"
import "fmt"
func main() {
C.SayHello(C.CString("Hello, World\n"))
}
//export cgoPuts
func cgoPuts(s *C.char) {
fmt.Print(C.GoString(s))
}