vs2017 linking realsense camera

2

I'm trying to use a Intel RealSense camera in a c# project.
While the example code seams to run just fine.

My own project in a different folder raises an exception. Unable to load DLL
"realsense2:The specified module could not be found. (Exception from HRESULT:0x8007007E)."

I've now placed the realsense2.dll in lib folder and in debug folder. I think its a unmanaged dll and the other "Intel.RealSense.dll" seams a .net interface dll . I placed both in lib and in debug folders I tried referencing the Intel.realsense.dll (.net api wrapper) in both locations (debug folder and in lib folder), but to no success.

From Intel forums I noted that sometimes the error gets raised when the CPU model isn't correct, but I kept those the same as the sample. This must be some visual studio error (since the Intel example works). But I miss where it goes wrong.

c#
visual-studio-2017
realsense
asked on Stack Overflow Jul 9, 2018 by user3800527

2 Answers

2

Step 1. Build the provided C++/C# samples using the instructions located in the main repo under /wrappers/csharp/readme.md

  • Generate the VS solution using cmake (run from librealsense root dir):

    • mkdir build
    • cd build
    • cmake .. -DBUILD_CSHARP_BINDINGS=ON -DBUILD_SHARED_LIBS=ON
  • The file realsense2.sln should be created in build folder, open the file with Visual Studio, C# examples and library will be available in the solution under Wrappers/csharp.

Both the native library and the .NET wrapper are built by default as part of the examples dependencies.

Step 2. Take a look at the working samples for reference. The default librealsense build on Windows is Debug/Win32 (For this config, built samples will be available at your_librealsense_dir/build/Debug)

In your C# project you need to have Intel.RealSense.dll added as a reference and copy realsense2.dll in your build directory ex: your_project_home/bin/x86/Debug

answered on Stack Overflow Aug 22, 2018 by Prototype • edited Aug 22, 2018 by Prototype
0

Note: Looking below, I think it's likely you have all these DLLs. Possibly you have a path issue. Check your EXE is running from the same folder the DLLs are in.

Here are the dependencies of realsense2.dll (x86) output by DUMPBIN:

These Windows ones:

KERNEL32.dll
USER32.dll
ole32.dll
OLEAUT32.dll
ADVAPI32.dll
SHLWAPI.dll
CFGMGR32.dll
SETUPAPI.dll
MF.dll
MFPlat.DLL
MFReadWrite.dll
WINUSB.DLL

And this VS 2017 one:

VCOMP140.DLL

Dependency Walker will tell you which ones you do or don't have.

answered on Stack Overflow Jul 12, 2018 by Nick Westgate • edited Jul 12, 2018 by Nick Westgate

User contributions licensed under CC BY-SA 3.0