Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Go code generate dll in windows or can C ++/C# call golang code?

Tags:

go

Can Go functions be called by C++ or C# code on windows? Does Go support generating dll in Windows?

like image 304
Pole_Zhang Avatar asked Dec 05 '12 09:12

Pole_Zhang


People also ask

Does go use C?

Go does not require any C libraries if that's what you're asking.

What is DLL in C#?

A DLL is a library that contains code and data that can be used by more than one program at the same time. For example, in Windows operating systems, the Comdlg32 DLL performs common dialog box related functions.


1 Answers

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.

like image 78
thwd Avatar answered Oct 13 '22 18:10

thwd