Example #1
0
// Hello prints a string via C's stdio
func Hello(s string) {
	if s == "" {
		s = "you"
	}
	cstr := C.CString(fmt.Sprintf("hello %s from go\n", s))
	defer C.free(unsafe.Pointer(cstr))
	C.cpkg_printf(cstr)
}
Example #2
0
// Printf prints a string via C's stdio
func Printf(format string, args ...interface{}) {
	str := fmt.Sprintf(format, args...)
	cstr := C.CString(str)
	defer C.free(unsafe.Pointer(cstr))
	C.cpkg_printf(cstr)
}
Example #3
0
// Hi prints hi from Go (via C's stdio)
func Hi() {
	cstr := C.CString("hi from go\n")
	defer C.free(unsafe.Pointer(cstr))
	C.cpkg_printf(cstr)
}