github.com/chenfeining/golangci-lint@v1.0.2-0.20230730162517-14c6c67868df/test/testdata/cgo/main.go (about)

     1  package cgoexample
     2  
     3  /*
     4  #include <stdio.h>
     5  #include <stdlib.h>
     6  
     7  void myprint(char* s) {
     8  	printf("%d\n", s);
     9  }
    10  */
    11  import "C"
    12  
    13  import (
    14  	"unsafe"
    15  )
    16  
    17  func Example() {
    18  	cs := C.CString("Hello from stdio\n")
    19  	C.myprint(cs)
    20  	C.free(unsafe.Pointer(cs))
    21  }