cgo4.go 374 B

123456789101112131415161718
  1. // Copyright 2012 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package print
  5. // #include <stdio.h>
  6. // #include <stdlib.h>
  7. import "C"
  8. import "unsafe"
  9. func Print(s string) {
  10. cs := C.CString(s)
  11. defer C.free(unsafe.Pointer(cs))
  12. C.fputs(cs, (*C.FILE)(C.stdout))
  13. }
  14. // END OMIT