1
0
mirror of https://github.com/golang/go synced 2024-11-19 01:54:39 -07:00
go/internal/lsp/testdata/cgo/declarecgo.go
Heschi Kreinick 05c67e95c4 internal/lsp: add tests for cgo package users
We now have pretty good support for users of cgo packages. Add tests.

Closes golang/go#35720.

Change-Id: Icdc596038bc6fca1c08eacd199def12264cf512d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/208503
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-11-25 19:20:57 +00:00

27 lines
374 B
Go

package cgo
/*
#include <stdio.h>
#include <stdlib.h>
void myprint(char* s) {
printf("%s\n", s);
}
*/
import "C"
import "fmt"
import "unsafe"
func Example() { //@mark(funccgoexample, "Example"),item(funccgoexample, "Example", "func()", "func")
fmt.Println()
cs := C.CString("Hello from stdio\n")
C.myprint(cs)
C.free(unsafe.Pointer(cs))
}
func _() {
Example()
}