Skip to content

cgo: cannot use C reference variable created by one package in another #59606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gucio321 opened this issue Apr 13, 2023 · 4 comments
Closed

Comments

@gucio321
Copy link
Contributor

gucio321 commented Apr 13, 2023

What version of Go are you using (go version)?

$ go version
go version go1.20.2 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/gucio/.cache/go-build"
GOENV="/home/gucio/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/gucio/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/gucio/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1985314571=/tmp/go-build -gno-record-gcc-switches"

What did you do?

hi
cgo is an awesome tool.
sometimes however it is really confusing 😕
I'm trying to make a generic package used to convert GO types into C types.
The problem is that package, where I'm using converted type complains about them not being of the same type...

wrapper reference: https://github.com/gucio321/cimgui-go/blob/wrapper-extract/internal/wrapper/type_wrapper.go
project ref: gttps://github.com/gucio321/cimgui-go/tree-wrapper-extract

What did you expect to see?

as C is treated as pseudo-package (import "C") C.char/C.int should (in my opinion) be equal, shouldn't they?

What did you see instead?

cannot use text_beginArg (variable of type *wrapper._Ctype_char) as *_Ctype_char value in variable declaration
@gucio321
Copy link
Contributor Author

here is a quick example: https://github.com/gucio321/cgo-bug

@seankhliao
Copy link
Member

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Apr 13, 2023
@gucio321
Copy link
Contributor Author

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao I know it may be a bit subjective, but I consider this a bug anyway.

@ianlancetaylor
Copy link
Contributor

Dup of #13467.

@golang golang locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants