开发者

Can I use shared objects with Go?

开发者 https://www.devze.com 2022-12-19 20:58 出处:网络
Can I use开发者_如何学JAVA shared objects with Go?According to the Go FAQ, you can call into C libraries using a "foreign function interface":

Can I use开发者_如何学JAVA shared objects with Go?


According to the Go FAQ, you can call into C libraries using a "foreign function interface":

Do Go programs link with C/C++ programs?

There are two Go compiler implementations, 6g and friends, generically called gc, and gccgo. Gc uses a different calling convention and linker and can therefore only be linked with C programs using the same convention. There is such a C compiler but no C++ compiler. Gccgo is a GCC front-end that can, with care, be linked with GCC-compiled C or C++ programs. However, because Go is garbage-collected it will be unwise to do so, at least naively.

There is a “foreign function interface” to allow safe calling of C-written libraries from Go code. We expect to use SWIG to extend this capability to C++ libraries. There is no safe way to call Go code from C or C++ yet.

To answer your earlier question about Windows DLL's: no, as there is currently not a windows implementation of Go. For more information, read can-go-compiler-be-installed-on-windows

0

精彩评论

暂无评论...
验证码 换一张
取 消