问题
I am just beginning to use ZeroMQ and am experimenting with some of the samples. I am using the C# language bindings and have run into an issue with getting a DllNotFound Exception.
I can Load and run samples on My development machine after having copied libzmq.dll into Windows/System32, but when I move things to other servers, I get the error despite copying the libzmq.dll into both the folder the samples are running from and into Windows/System32.
I have put clzmq.dll into the Folder the sample app is in and also libzmq.dll Also, I put libzmq into c:/Windows/System32. I am running Windows Server 2003 Service Pack 2. When I check the machine Environment Variables, WINDOWS/System32 is in the PATH variable. I also made certain to build the libzmq dll using Release, not debug.
It is possible that I don't understand how the ZeroMQ .Net Binding should be used. I have added clzmq.dll (The .Net Binding) to my project as reference and I assumed that clzmq.dll would automatically reference libzmq on the Windows PATH variable WINDOWS/System32.
Does anyone know if I am mistaken on this. The C# Binding documentation ( http://www.zeromq.org/bindings:clr) states that the "ZeroMQ library file will need to be made available for the binding to work", but it seams I have failed to make it available despite copying it into the PATH variable.
Has anyone experienced the DLL not found exception when using the ZeroMQ .Net Bindings?
Thanks for the help,
回答1:
I encountered this exact error on Windows Server 2008. As soon as my code attempted to create a clrzmq (2.2.3) object, Windows tried to load the DLL and failed with the error:
Unable to load DLL 'libzmq': The specified module could not be found.
The DLL is most definitely present. I attempted a variety of solutions with permissions, all of which failed to resolve the problem. Downloading & installing the VS2010 C++ redistributable solved my problem.
回答2:
I still have the same problem after I checked my system does have Microsoft Visual C++ 2010 Redistributable. My OS is Windows 7 64bit. I got ZeroMQ library from NuGet in Visual Studio 2010.
PS, I found the solution to solve my error. When downloading ZeroMQ from NuGet in VS, there is actually a warning that I ignored at first. It says to manually copy libzmq.dll to output directory of the project besides reference of clrzmq2. After manually copy libzmq.dll to output directory, it is working now. By the way, I tried to copy libzmq.dll to C:\Windows\System32 as mentioned by above, it didn't work too.
Hope it helps.
回答3:
If you are using the NuGet ZeroMQ package and you receive the error:
Unable to load DLL 'libzmq'
Go to Solution Explorer and see that the NuGet package has added amd64 and i386 folders for you. Expand these folders, select every file within them, then go to the Properties window and select "Copy if newer" for "Copy to Output Directory".
This appears to be the most elegant solution to the problem and works for both architectures automatically. Windows will search current path + i386/amd64 based on architecture.
回答4:
I had the problem with Unable to load DLL 'libzmq' The problem here is the location of i386 folder. I solved moving i386 folder / for 32 bit / in the project root. Similar to Warren's solution above.
来源:https://stackoverflow.com/questions/4718262/zeromq-dllnotfoundexception-using-net-bindings