title: Mono: DllImport unable to load library '(null)'
body: <p>I'm trying to use the <a href="http://github.com/zeromq/clrzmq" rel="nofollow">C# ZeroMQ bindings</a>.  However on Mono 2.8 and OSX 10.6.4, when I try to run an example application, I get a DLLImport error.  Specifically:</p>
  
  <pre><code>Unhandled Exception: System.DllNotFoundException: libzmq
    at (wrapper managed-to-native) ZMQ/C:zmq_init (int)
    at ZMQ+Context..ctor (Int32 io_threads) [0x00000] in &lt;filename unknown&gt;:0 
    at local_lat.Main (System.String[] args) [0x00000] in &lt;filename unknown&gt;:0
  </code></pre>
  
  <p>This function is simply:</p>
  
  <pre><code>    [DllImport("libzmq", CallingConvention = CallingConvention.Cdecl)]
      public static extern IntPtr zmq_init(int io_threads);
  </code></pre>
  
  <p>When I use MONO_LOG_LEVEL=debug, mono shows it looking for libzmq but continually failing with things like:</p>
  
  <pre><code>Mono: DllImport loading library: './libzmq.dylib'.
  Mono: DllImport error loading library '(null)'.
  </code></pre>
  
  <p>I've tried moving the libzmq.dylib to the local folder and setting up a libzmq.dll.config file, both to no avail.</p>
  
  <p>Is there an obvious reason why Mono is failing to find libzmq.dylib, which is located in /usr/local/lib?  And why does the error become "(null)"?</p>