c++ - golang : call C++ code in cross platform

标签 c++ macos go

有没有办法从 Go 调用 C++ 代码?我需要在 Windows 和 Mac 中调用 C++ 代码。 Go语言支持跨语言集成吗?

最佳答案

SWIG and Go

Go is a compiled language, not a scripting language. However, it does not support direct calling of functions written in C/C++. The cgo program may be used to generate wrappers to call C code from Go, but there is no convenient way to call C++ code. SWIG fills this gap.

使用 SWIG。

关于c++ - golang : call C++ code in cross platform,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22124781/

相关文章:

c++ - 遇到 C++ 位图问题

c++ - 从容器中提取指针的语法 back()

C++显示一维数组

macos - 如何阻止 NSTextField 中的某些键盘布局?

mysql - Docker:Mysql在启动后几秒钟后崩溃

MySQL,如何在Mac终端中执行 "sudo kill -9 [PID]"

java - 是否会在编译时优化局部变量的一次性使用?

google-app-engine - gcloud app deploy 尝试编译不需要的文件,我可以排除部分树吗?

go - 错误: "build flag -mod=vendor only valid when using modules" when building Go project

go - 奇怪的协程行为