Run compiled golang dll file

Hello all,

I’m new in go.

i was looking for how to create a dll file from go and i used the following command

go build -o client.dll -buildmode c-shared

My fiile has a main function without any code on it and i have another function called “TestMain”
which contain the all reuired code for the script. Now how should i run this dll ? i tried with : rundll32 client.dll,TestMain
but i got an error that “Missing Entry: TestMain” so i need to know how can i compile it and run it

Why are you compiling it as a DLL? Why not just go build . and then .\program.exe?

i need the output to be a DLL for other testing purposes.

It seems the problem because i didn’t write any code in the main function, so i write a simple print line and then i compiled using.
go build -ldflags “-s -w” -buildmode=c-shared -o file.dll ./file.go

Then run with rundll32 file.dll,TestMain

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.