Can Go functions be called by C++
or C#
code on windows? Does Go support generating dll in Windows?
Asked
Active
Viewed 1.1k times
11

icza
- 389,944
- 63
- 907
- 827

Pole_Zhang
- 1,377
- 3
- 12
- 14
-
I know gccgo is sometimes more compatible this way, but I don't think even it can compile to a DLL yet... – rogerdpack Sep 29 '14 at 20:37
-
Some work in that direction has been undertaken, see [issue 11058](https://github.com/golang/go/issues/11058). August 2016: not done yet. – Deleplace Aug 23 '16 at 14:10
1 Answers
9
No, Go code is statically linked. The reason for this is Go's runtime, which is embeded in every executable, among other things.
Edit:
It is apparently possible with a lot of indirection, but far from usable in practice. See Call go functions from C and the linked blog posts for more information.