github.com/tpounds/golangci-lint@v1.10.1/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 "unsafe"
    14  
    15  func Example() {
    16  	cs := C.CString("Hello from stdio\n")
    17  	C.myprint(cs)
    18  	C.free(unsafe.Pointer(cs))
    19  }