You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
I have not checked on go1.17 yet.
What operating system and processor architecture are you using (go env)?
windows/amd64
What did you do?
I want to use a golang module as c-shared library and then call it from a MFC application.
I built the go module as c-shared library(example.dll) and example.h file successfully.
I created simple C program, included example.h file and called my library function, I built the program with gcc command, everything worked as expected.
On MFC project, included example.h file and called my library function, then used VS2019 Community to build. Error came out.
error E0020: identifier "__SIZE_TYPE__" is undefined
error E0065: expected ';'
error C2143: syntax error : missing '}' before 'enum [tag]'
I checked on Internet and found out that the problem is about compiler.
On VS2019, they use msvc as compiler for C program so when I include a cgo built library (which is using gcc by default) on VS2019 project, there are some conflicts between them.
What version of Go are you using (
go version
)?go version go1.15.6
Does this issue reproduce with the latest release?
I have not checked on go1.17 yet.
What operating system and processor architecture are you using (
go env
)?windows/amd64
What did you do?
I want to use a golang module as c-shared library and then call it from a MFC application.
I checked on Internet and found out that the problem is about compiler.
On VS2019, they use msvc as compiler for C program so when I include a cgo built library (which is using gcc by default) on VS2019 project, there are some conflicts between them.
I tried to find a way to build my golang module to c-shared library with msvc compiler and found this.
https://go-review.googlesource.com/c/go/+/133946
Unfortunately, this [cmd/compile: add support for MSVC toolchain to go build] change is still in review.
What did you expect to see?
So if there is an official guide about using cgo built library on VS2019, I would be happy.
What did you see instead?
Included in [What di you do?] section.
The text was updated successfully, but these errors were encountered: