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?
Asked
Active
Viewed 816 times
1 Answers
0
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.

georgeok
- 5,321
- 2
- 39
- 61
-
Should I use syscall.LoadLibrary() or syscall.LoadDLL? Is there any difference? – user9716692 Jun 22 '19 at 16:40
-
They both work but have different returns. LoadDLL returns a struct with the dll name and a handle with LoadLibrary just a handle. If you need the dll name use the first, otherwise the second. – georgeok Jun 22 '19 at 18:20
-
Get it, thanks! Is there any function returns function names in DLL? – user9716692 Jun 23 '19 at 04:27
-