libzmq not found by clrzmq in Xamarin Studios/C# application

会有一股神秘感。 提交于 2019-12-10 10:08:56

问题


I'm using Xamarin Studio on a Mac, with clrzmq included via NuGet.

clrzmq references on libzmq.dll. My app compiles fine, but when I try to run it, I get this:

Unhandled Exception:
System.DllNotFoundException: libzmq
  at (wrapper managed-to-native) ZMQ.C:zmq_init (int)
  at ZMQ.Context..ctor (Int32 io_threads) [0x00000] in <filename unknown>:0 
  at FeatureSpike.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0 

libzmq.dll is definitely there in the build target directory. Does anyone know why it's not being found?


回答1:


you might want to try using netmq (https://github.com/zeromq/netmq), is a 100% C# port of zeromq and might be easier to use then calling pinvoke.




回答2:


if you're still looking for a solution...

You can use clrzmq4 and add statically linked libzmq and libsodium as native libraries to your xamarin solution.

Ensure you use the very latest version of clrzmq4,we just got it running today...




回答3:


Is libzmq.dll next to your executable in the build output directory ?

The clrzmq NuGet package includes a PowerShell install script to set the build action for the libzmq.dll so it is always copied to the output directory. If you added the NuGet package on the Mac then the PowerShell script will not be run. So you will need to set the build action manually.

libzmq.dll seems to be a native dll compiled for Windows so it will not work on the Mac. So it looks like you will have to compile clrzmq on the Mac.




回答4:


Have you created a dllmap in your config?

<configuration>
    <dllmap dll="libzmq.dll" target="/usr/local/Cellar/zeromq/4.0.4/lib/libzmq.dylib"/>
</configuration>


来源:https://stackoverflow.com/questions/22209398/libzmq-not-found-by-clrzmq-in-xamarin-studios-c-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!