英文:
Golang syscall.NewLazyDLL in Linux
问题
有没有办法在Ubuntu中加载syscall.NewLazyDLL?
我尝试了以下代码:
GOOS=windows GOARCH=amd64 go build -ldflags "-w -s" -o myFileName *.go
但是无法找到syscall.NewLazyDLL。
var (
mod = syscall.NewLazyDLL("user32.dll")
procGetWindowText = mod.NewProc("GetWindowTextW")
)
我的目标是从我的主Ubuntu操作系统加载"windows"系统调用函数,这样我就不需要切换到Windows来编写代码了。是否有办法让Ubuntu调用syscall.NewLazyDLL中的Windows函数,还是我必须在Windows中编写代码?
英文:
Is there any way to load the syscall.NewLazyDLL in Ubuntu?
I tried:
GOOS=windows GOARCH=amd64 go build -ldflags "-w -s" -o myFileName *.go
but the syscall.NewLazyDLL is not found.
var (
mod = syscall.NewLazyDLL("user32.dll")
procGetWindowText = mod.NewProc("GetWindowTextW")
)
My goal is to load the "windows" syscall functions, but from my main Ubuntu OS,
so I dont need to switch to Windows to code. Is there any way Ubuntu can call the Windows functions from syscall.NewLazyDLL or do I have to write code in Windows for this?
答案1
得分: 1
当然,你需要使用Windows,因为你想要开发Windows而不是Linux,使用syscall.NewLazyDLL("user32.dll")。
安装一个虚拟机。
英文:
Of course you have to be on Windows, you are wanting to develop for Windows and not Linux using syscall.NewLazyDLL("user32.dll").
Install a virtual machine.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论