Closed
Description
What version of Go are you using (go version
)?
go version go1.17.2 windows/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
set GO111MODULE= set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\qmuntaldiaz\AppData\Local\go-build set GOENV=C:\Users\qmuntaldiaz\AppData\Roaming\go\env set GOEXE=.exe set GOEXPERIMENT= set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GOMODCACHE=C:\Users\qmuntaldiaz\go\pkg\mod set GONOPROXY=github.com/microsoft/* set GONOSUMDB=github.com/microsoft/* set GOOS=windows set GOPATH=C:\Users\qmuntaldiaz\go set GOPRIVATE=github.com/microsoft/* set GOPROXY=https://proxy.golang.org,direct set GOROOT=C:\Program Files\Go set GOSUMDB=sum.golang.org set GOTMPDIR= set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64 set GOVCS= set GOVERSION=go1.17.2 set GCCGO=gccgo set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD=C:\Users\qmuntaldiaz\code\gotest\go.mod set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\QMUNTA~1\AppData\Local\Temp\go-build2404042358=/tmp/go-build -gno-record-gcc-switches
What did you do?
==foo.go==
package foo
// int StrLen(_GoString_ s) {
// return _GoStringLen(s);
// }
import "C"
import "fmt"
func Test() {
fmt.Println(C.StrLen1("goo"))
}
go tool cgo foo.go
What did you expect to see?
Only this error message:
foo.go:10:14: could not determine kind of name for C.StrLen1
What did you see instead?
I saw the previous error and a preamble error, when the preamble is perfectly fine.
foo.go:10:14: could not determine kind of name for C.StrLen1
cgo:
gcc errors for preamble:
foo.go:3:13: error: unknown type name '_GoString_'
3 | // int StrLen(_GoString_ s) {
| ^~~~~~~~~~
_GoString_
is defined in the buildin prolog but we are not adding the prolog to the preamble when checking if the preamble has any error:
Lines 492 to 495 in e7d5857
Metadata
Metadata
Assignees
Type
Projects
Status
Done