单声道树莓派抛出DLLNotFoundException在共享对象(.so)文件的DLLImport
我目前正在使用覆盆子pi(B)单声道运行时。我使用Windows桌面的Visual Studio Express 2012。我基本上想要实现的是将一系列图片从网络摄像头(Logitech C270)保存为.jpg文件。单声道树莓派抛出DLLNotFoundException在共享对象(.so)文件的DLLImport
我发现,似乎只是在做我需要一个项目: http://www.raspberry-sharp.org/romain-flechner/2012/10/projects/use-a-webcam-plugged-in-a-raspberry-pi-with-mono-in-c-using-raspberrycam/ 所以我通过的NuGet它安装到我的项目和复制的代码示例:
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);
写在说明书上项目页面,我将RaspberryCam.so复制到/ lib目录中(我也将它复制到/ Lib中)。然后我将构建的文件(my.exe,RaspberryCam.dll)下载到我的Raspberry PI中。
现在,这是我的问题: 每当我尝试用单声道执行我的程序,我得到RaspberryCam.so的DllNotFoundException。
我将我的项目路径添加到/etc/ld.so.conf并运行ldconfig,但这没有帮助。我试过在调试模式下运行mono(MONO_LOG_LEVEL =“debug”MONO_LOG_MASK =“dll”mono /var/www/my.exe),它似乎是在搜索“libRaspberryCam.so”,所以我复制了/lib/RaspberryCam.so添加到/lib/libRaspberryCam.so,但是这也没有改变任何东西。
顺便提一下,我将.so文件的访问权限更改为755(读取,写入,执行root和读取,执行世界)。
说实话,对于DLL导入的东西我并不是很了解,所以我可能会在这里犯一些愚蠢的错误。不过,我上周在raspberrycam项目页面上已经写了一条评论,但我还没有得到任何答案。
任何人都可以帮我解决这个问题吗?
感谢 多米尼克
编辑: 实际的DllImport的代码是从Raspberrycam工程 “RaspberryCamInterop.cs”:
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);
}
}
编辑2: 这似乎是一些问题与软浮动喘息。我现在已经安装了标准的硬浮动raspbian(正如它在项目页面上的指南中写的:http://www.raspberry-sharp.org/eric-bezine/2012/10/mono-framework/installing-mono-raspberry-pi/),它的工作原理,它不是特别快,但它确实保存了一张图片。 尽管mono与ARM hard-float abi不兼容,但我仍然觉得它们使用硬浮图像图像有点令人不快。 在单声道安装指南中,他们没有提到任何硬浮点补丁,我甚至在RaspberryCam项目的源代码中找到了一些解决方法,所以他们确实注意到了在硬核浮点abi上运行mono的错误。
片段来自“PicturesCache.cs”
//Timespan bug with ARM version of MONO, so we will use int in milliseconds
private readonly int duration;
不过,我会坚持使用软浮喘息,只使用了一个名为uvccapture协同一些shell脚本来完成这项工作的工具。
然而,我仍然感激你的任何建议或解决方案。
你尝试用
$sudo make
$sudo make install
?
验证RaspberryCam.so的权限并修复它为chmod。
再见
什么工作对我来说:我复制中的.exe文件夹中的lib和更名为libRaspberryCam.so。
在我身边,质量很差。我无法从此库配置相机。
我有同样的例外,它得到了复制RaspberryCam.so到/ usr/lib目录(而不是根/ lib中),使用externs和DLL导入属性
你已经解决了?实际执行导入和外部处理的代码将帮助很多。 – Pharap