如何在运行时使用.lib和.dll文件调用预构建的API? [关闭]
问题描述:
I have a PCI-E capture card, and I have to use APIs for it supplied by the manufacturer. They provide prebuilt .lib and .dll file. How can I use it in Golang? Or is it possible to get the output of capture card by using GOCV?
我有一个PCI-E捕获卡,并且必须使用制造商提供的API。 它们提供预构建的.lib和.dll文件。 如何在Golang中使用它? 或者可以使用GOCV获取捕获卡的输出吗? p> div>
答
There three ways:
- You can load and call the dll from Go. This is documented in https://github.com/golang/go/wiki/WindowsDLLs.
- You can load and call your dll or link the lib using cgo and call this from your Go code. This is more complicated and requires more brain power.
- You can use syscall.NewProc.
I would use the first. They are all documented in https://github.com/golang/go/wiki/WindowsDLLs with examples.
You can also look on Github for examples by searching for syscall.syscall9.
If your machine has the drivers and it’s openCV compatible you could use GOCV to capture data.