Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: -buildmode=dll is still not working in Go 1.10 #23588

Closed
muhammadmuzzammil1998 opened this issue Jan 28, 2018 · 13 comments
Closed

cmd/go: -buildmode=dll is still not working in Go 1.10 #23588

muhammadmuzzammil1998 opened this issue Jan 28, 2018 · 13 comments

Comments

@muhammadmuzzammil1998
Copy link

I read this issue, #11058, and it says that will be fixed in Go1.10 but its not working in Go1.10rc1.
I ran this command:

go1.10rc1.exe build -buildmode=dll

What did you expect to see?

I expected to see a .dll for my program.

What did you see instead?

Output:

buildmode=dll not supported

My Go Version: go version go1.10rc1 windows/amd64

More info:

  • I am building this program
  • My Go1.10rc1 is not added to path, I am using full location, i.e., C:\Users\Muzzammil\go\src\golang.org\x\build\version\go1.10rc1\go1.10rc1.exe so full command is:
C:\Users\Muzzammil\go\src\golang.org\x\build\version\go1.10rc1\go1.10rc1.exe build -buildmode=dll

Thanks.

@AlexRouSg
Copy link
Contributor

AlexRouSg commented Jan 28, 2018

Where did you get buildmode=dll from? As far as I can tell the arg is still buildmode=c-shared

@muhammadmuzzammil1998
Copy link
Author

muhammadmuzzammil1998 commented Jan 28, 2018

@AlexRouSg
It's mentioned in the issue #11058, but it's not in Go help.
image

You can use go help buildmode to get this info:
image

@AlexRouSg
Copy link
Contributor

I think you are mistaking a suggestion for the actual implementation. Nowhere is buildmode=dll mentioned as being added.

Even in that issue, they used buildmode=c-shared to create dlls.

@muhammadmuzzammil1998
Copy link
Author

So, how do I make a DLL?

@AlexRouSg
Copy link
Contributor

As I've said in both replies, use buildmode=c-shared

@muhammadmuzzammil1998
Copy link
Author

I am getting this:

C:\Users\Muzzammil\sdk\go1.10rc1\pkg\tool\windows_amd64\link.exe: running gcc failed: exec: "gcc": executable file not found in %PATH%

@AlexRouSg
Copy link
Contributor

You need to install mingw

For questions please use https://github.com/golang/go/wiki/Questions

@muhammadmuzzammil1998
Copy link
Author

muhammadmuzzammil1998 commented Jan 28, 2018

Now I am getting this:

C:\Users\Muzzammil\sdk\go1.10rc1\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
C:\Users\MUZZAM~1\AppData\Local\Temp\go-link-763910195\go.o: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status

@muhammadmuzzammil1998
Copy link
Author

Thank you @AlexRouSg, I thought that -buildmode=dll was a thing.

@hank
Copy link

hank commented May 12, 2018

You need mingw-64. I just was able to link an amd64 DLL using that.

@muhammadmuzzammil1998
Copy link
Author

Thanks @hank

@shyandsy
Copy link

@AlexRouSg
It only generate .a libray by buildmode=c-shared, and it can not be used in VC porject

any solution to build windows dll?

@shyandsy
Copy link

@muhammadmuzzammil1998
i suffered same issue, and I solved that by add GOPATH to system variable (was in user variables)

@golang golang locked and limited conversation to collaborators Nov 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants