Home > other >  How GO to compile dependent DLL file into exe file
How GO to compile dependent DLL file into exe file

Time:11-18

Just started to learn golang, watching a great god video himself wrote a small tool, generated exe files after; Run on the local computer is no problem, but to get the other computer, so glib related DLL file does not exist; Strives for the great god, how to make packaging exe can run in any WINDOWs,

CodePudding user response:

DLL is loaded dynamically, so other people's Windows need ready in advance the DLL
First of all make it clear that glib related DLL which code to use, these code to load the DLL path is relative or absolute path?
Then according to the investigation on the path to the DLL as a resource pack, before starting the main program to determine whether a target path exists DLL, if there is no resource bundles of DLL is copied to the target path,

CodePudding user response:

Add, go pack static resources, can use the go - bindata, lz Google baidu by oneself, or refer to the following
https://c.isme.pub/2019/01/10/go-static/

CodePudding user response:

Thank the great god, made of gotk3 graphics, today try to find related dependence, was just thinking about how to package,

CodePudding user response:

refer to the second floor qybao response:
add, go pack static resources, can use the go - bindata, lz Google baidu by oneself, or refer to the following
https://c.isme.pub/2019/01/10/go-static/

Thank the great god, made of gotk3 graphics, today try to find related dependence, was just thinking about how to package, I try tomorrow

CodePudding user response:

Still don't have a package in an EXE, false positives will be antivirus software, let's do the installation package,

CodePudding user response:

Go to add parameter specifies the static build to build, such as:
Go build - ldflags "- linkmode external extldflags - static" webapi. Go
  • Related