github.com/varialus/godfly@v0.0.0-20130904042352-1934f9f095ab/doc/progs/cgo3.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  	C.fputs(cs, (*C.FILE)(C.stdout))
    16  	C.free(unsafe.Pointer(cs))
    17  }
    18  
    19  // END OMIT