-
Notifications
You must be signed in to change notification settings - Fork 18k
Fail to call c++ static lib. #39455
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
Comments
I don't think cgo can handle C++ name mangling, and you need to export your C++ functions with an
Note I also changed the name from |
Thinking about it further, I'm going to reopen this. I think it might be valuable to fail earlier for the user. Your reasonable assumptions about what should happen should have failed in a more friendly manner. |
This actually isn't due to C++ symbol name mangling. C++ doesn't mangle the name The problem is that the Go runtime also provides a symbol So the upshot is that you can't use a symbol named I'm going to close this issue again. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Put
main.cpp
,main.hpp
,main.go
,Makefile
in the same folder and runmake
.main.cpp
main.hpp
main.go
Makefile
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
As mentioned before
What did you expect to see?
It should return without error.
What did you see instead?
As mentioned before
The text was updated successfully, but these errors were encountered: