1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-24 20:52:22 +00:00
2018-12-15 15:34:16 +08:00

26 lines
405 B
Go

// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
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))
}