title: mono on raspberry pi throws DLLNotFoundException at DLLImport of shared object (.so) file
body: <p>I am currently working with the mono run-time on a raspberry pi (B). I use Visual Studio Express 2012 for Windows Desktop. What i basically want to achieve is to save a series of pictures from a webcam (Logitech C270) to a .jpg file.</p>
  
  <p>I found a project that seems to do just what i need:
  <a href="http://www.raspberry-sharp.org/romain-flechner/2012/10/projects/use-a-webcam-plugged-in-a-raspberry-pi-with-mono-in-c-using-raspberrycam/" rel="nofollow">http://www.raspberry-sharp.org/romain-flechner/2012/10/projects/use-a-webcam-plugged-in-a-raspberry-pi-with-mono-in-c-using-raspberrycam/</a>
  So I installed it via NuGet into my project and copied the code sample:</p>
  
  <pre><code>Cameras cameras = Cameras.DeclareDevice()
  .Named(“Camera 1″).WithDevicePath(“/dev/video0″)
  .Memorize();
  
  cameras.Get(“Camera 1″).SavePicture(new PictureSize(640, 480), “/var/www/test.jpg”, 20);
  </code></pre>
  
  <p>As written in the instructions on the project page, I copied the RaspberryCam.so into the /lib directory (I also copied it to /Lib for that matter). Then I downloaded the built files (my.exe, RaspberryCam.dll) to my Raspberry PI.</p>
  
  <p>Now here's my problem:
  Whenever I try to execute my program with mono I get a DllNotFoundException for RaspberryCam.so.</p>
  
  <p>I added my project path to /etc/ld.so.conf and ran ldconfig but that doesn't help.</p>
  
  <p>I also tried running mono in debug mode (MONO_LOG_LEVEL="debug" MONO_LOG_MASK="dll" mono /var/www/my.exe) and it appears to be searching for "libRaspberryCam.so", so I copied the /lib/RaspberryCam.so to /lib/libRaspberryCam.so, but that didn't change anything either. </p>
  
  <p>BTW i changed the access rights of the .so file to 755 (read, write, execute for root and read, execute for world).</p>
  
  <p>To be honest with you, I don't really know much about DLL-Import stuff so i could just be making some dumb mistake here. However I've already written a comment in the raspberrycam project page last week but I didn't get any answer yet.</p>
  
  <p>Can anyone help me with this matter?</p>
  
  <p>Thanks
  Dominik</p>
  
  <p>Edit:
  The Code of the actual DLLImport is from the Raspberrycam project "RaspberryCamInterop.cs":</p>
  
  <pre><code>using System;
  using System.Runtime.InteropServices;
  
  namespace RaspberryCam.Interop
  {
      public class RaspberryCamInterop
      {
          [DllImport("RaspberryCam.so", EntryPoint = "TakePicture")]
          public static extern PictureBuffer TakePicture(string device, uint width, uint height, uint jpegQuantity);
  
          [DllImport("RaspberryCam.so", EntryPoint = "OpenCameraStream")]
          public static extern IntPtr OpenCameraStream(string device, uint width, uint height, uint fps);
  
          [DllImport("RaspberryCam.so", EntryPoint = "CloseCameraStream")]
          public static extern void CloseCameraStream(IntPtr src);
  
          [DllImport("RaspberryCam.so", EntryPoint = "ReadVideoFrame")]
          public static extern PictureBuffer ReadVideoFrame(IntPtr src, uint jpegQuantity);
  
          [DllImport("RaspberryCam.so", EntryPoint = "GrabVideoFrame")]
          public static extern PictureBuffer GrabVideoFrame(IntPtr src);
      }
  }
  </code></pre>
  
  <p>Edit 2:
  It appears to be some problem with the soft-float wheezy. I have now installed the standard hard-float raspbian (as it was written in the guide on the project page: <a href="http://www.raspberry-sharp.org/eric-bezine/2012/10/mono-framework/installing-mono-raspberry-pi/" rel="nofollow">http://www.raspberry-sharp.org/eric-bezine/2012/10/mono-framework/installing-mono-raspberry-pi/</a>) and it works, well it isn't particularly fast but it does save a picture.
  I find it a bit irritating that they used the hard-float raspbian image even though mono isn't compatible with the ARM hard-float abi.
  In the mono installation guide they don't mention any hard-float patch either and I've even found some workarounds in the source code of the RaspberryCam project, so they did notice the bugs related with running mono on hard-float abi.</p>
  
  <p>Snippet from "PicturesCache.cs"</p>
  
  <pre><code>//Timespan bug with ARM version of MONO, so we will use int in milliseconds
  private readonly int duration;
  </code></pre>
  
  <p>However, I'm going to stick with the soft-float wheezy and just use a tool called uvccapture in collaboration with some shell scripts to do the job.</p>
  
  <p>Yet I am still grateful for any advice or solution from you.</p>