1

我正在尝试使用 libusb 将一些 C 源代码(Linux)移植到 C#(Windows)。我在 Windows 7 上成功安装了 LibUsbDotNet。然后我继续添加using MonoLibUsb,因为它看起来是最简单的移植路径。但是,在运行时会出现一个异常,说libusb-1.0.dll缺少。事实上,我似乎无法在C:\Windows\System32. 所以,两个问题

  1. 我在哪里可以找到它?在线搜索并没有发现任何方便的安装程序包。
  2. 为什么它不作为 LibUsbDotNet 的一部分安装?AFAICS 缺少它使 LibUsbDotNet 的一半无法使用。
4

1 回答 1

3

在使用 LibUsbDotNet 库编译 C# 程序时,在您的帖子发布一年后偶然发现了同样的问题:

PS C:\src\FaultMonitor\FaultMonitor\bin\Debug> .\FaultMonitor.exe -u
An error occured while executing the proxy:
libusb-1.0.dll not found. If this is a 64bit operating system, ensure that the 6
4bit version of libusb-1.0.dll exists in the '\Windows\System32' directory.
at MonoLibUsb.MonoUsbSessionHandle..ctor()

对于处于类似困境的任何人,请下载libusb库并提取内容(您将需要7zip)。在提取的内容中,将 复制\MS32\dll\libusb-1.0.dll到您的C:\windows\SysWOW64\文件夹中并将 复制\MS64\dll\libusb-1.0.dll到您的C:\windows\System32\. 之后,程序运行没有问题:

PS C:\src\FaultMonitor\FaultMonitor\bin\Debug> .\FaultMonitor.exe -u
[15-10-23.02:09:05][+] Device: VendorID: 4203, ProductID: 63, Address: 1
[15-10-23.02:09:05][+] Device: VendorID: -32530, ProductID: 33, Address: 2
于 2015-10-23T10:50:56.833 回答