Using syscall in Go how can I call the UWP APIs within Windows 10? I have seen and tried many win32 examples, but when I tried using System.WindowsRuntime.dll it was a no-go; specifically, I received:
panic: Failed to load System.WindowsRuntime.dll: The specified module could not be found.
(this was at runtime, the binary built fine)
I tried building both with a standard go build as well as
go build -ldflags="-H windows"
example code:
var(
windowsRuntime = syscall.NewLazyDLL("System.WindowsRuntime.dll")
getDiskFreeSpace = windowsRuntime.NewProc("GetDiskFreeSpace")
)
Note: Other variants tried:
windowsRuntime = syscall.NewLazyDLL("System.Runtime.WindowsRuntime.dll")
&
windowsRuntime = syscall.NewLazyDLL("WindowsRuntime.dll")
Anyone been able to get this running or have any advice on the matter? As always, greatly appreciated!!
System.WindowsRuntime.dllfrom? Are you trying to call theGetDiskFreeSpace()method of a specific UWP class? If so, you're in for a world of hurt...kernel32.dllit is, not sure where I got that from, I am trying to retrace my steps, in any event, theSystem.WindowsRuntime.dllwas not found withpanic: Failed to load System.WindowsRuntime.dll: The specified module could not be found.whereas when I had the wrong function/procedure nameGetDiskFreeSpaceI receivedpanic: Failed to find GetDiskFreeSpace procedure in Kernel32.dll: The specified procedure could not be found.SoSystem.WindowsRuntime.dllis definitely missing. Now just to figure out where if that is even the proper name. I'll get back to you briefly.GetDiskFreeSpaceWand you'll be good - just in case others come across this question.