3

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?

Grant Birchmeier
  • 17,809
  • 11
  • 63
  • 98
  • Having the same issue on Raspian. Runs ok on windows... libzmq.dll is in the build directory. Odd – Mike S Aug 20 '15 at 22:01

4 Answers4

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.

somdoron
  • 4,653
  • 2
  • 16
  • 24
1

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...

Markus Gilli
  • 227
  • 2
  • 8
0

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.

Matt Ward
  • 47,057
  • 5
  • 93
  • 94
0

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>
  • Where exactly is this config file / option ?, Will it be in my Xamarin IDE – a k Jan 05 '17 at 21:00
  • in your app.config. Find out more about this at . http://www.mono-project.com/docs/advanced/pinvoke/dllmap/ and http://www.mono-project.com/docs/advanced/pinvoke/ – Rainer Schuster Jan 19 '17 at 17:26