github.com/jd-ly/tools@v0.5.7/internal/lsp/testdata/cgo/declarecgo.go (about)

     1  package cgo
     2  
     3  /*
     4  #include <stdio.h>
     5  #include <stdlib.h>
     6  
     7  void myprint(char* s) {
     8  	printf("%s\n", s);
     9  }
    10  */
    11  import "C"
    12  
    13  import (
    14  	"fmt"
    15  	"unsafe"
    16  )
    17  
    18  func Example() { //@mark(funccgoexample, "Example"),item(funccgoexample, "Example", "func()", "func")
    19  	fmt.Println()
    20  	cs := C.CString("Hello from stdio\n")
    21  	C.myprint(cs)
    22  	C.free(unsafe.Pointer(cs))
    23  }
    24  
    25  func _() {
    26  	Example() //@godef("ample", funccgoexample),complete("ample", funccgoexample)
    27  }