github.com/zach-klippenstein/go@v0.0.0-20150108044943-fcfbeb3adf58/doc/progs/cgo4.go (about) 1 // skip 2 3 // Copyright 2012 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 package print 7 8 // #include <stdio.h> 9 // #include <stdlib.h> 10 import "C" 11 import "unsafe" 12 13 func Print(s string) { 14 cs := C.CString(s) 15 defer C.free(unsafe.Pointer(cs)) 16 C.fputs(cs, (*C.FILE)(C.stdout)) 17 } 18 19 // END OMIT