Cebru Stick: Problem with DLLs in VS2010 .Net C# (english)

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • Cebru Stick: Problem with DLLs in VS2010 .Net C# (english)

      In my c# project I have included "cebomsrnet-1.4.dll" and unsed example code provided from CESYS (code see below).

      The problem is now, that the dll is linked to other dlls which can not be found in my project. I have added to the debug folder the dll required in the following error code. But still it doesnot work.

      "Unable to load DLL 'cebomsr-1.4-x86': Das angegebene Modul wurde nicht gefunden. (Exception from HRESULT: 0x8007007E)"->Fehler ist aufgetreten in der Klasse SystemConnector.

      I am not sure weather this is a gerneral .net dll linking problem or the dlls problem. Please give me a tip how to proceed. I have spend some hours with that problem already also reading general .net forums.

      Quellcode:
      private void FrameIoTestStick(Device device)
      {
      // Prepare and fill the list of inputs to read.
      IInput[] inputs = new IInput[]
      {
      device.SingleEndedInputs[0],
      device.SingleEndedInputs[1],
      device.DigitalPorts[0],
      device.Counters[0]
      };

      // Setup device with this selection.
      device.SetupInputFrame(inputs);

      // Read the values multiple times and write them to the console.
      for (int i = 0; i < 100; ++i)
      {
      // Read all inputs into the instance of InputFrame.
      InputFrame inFrame = device.ReadFrame();

      // Write results to the console.
      Console.WriteLine(
      "DigitalPort #0: " + inFrame.GetDigitalPort(0) + ", " +
      "SingleEnded #0: " + inFrame.GetSingleEnded(0) + " V, " +
      "SingleEnded #1: " + inFrame.GetSingleEnded(1) + " V, " +
      "Counter #0: " + inFrame.GetCounter(0));
      }

      // Reset to power up defaults.
      device.ResetDevice();
      }

      /// <summary>
      /// The examples main method.
      /// </summary>
      private void RunExample()
      {
      try
      {
      // Search for devices ...
      IList<Device> devices = LibraryInterface.Enumerate(DeviceType.All);

      // If at least one has been found, use the first one ...
      if (devices.Count > 0)
      {
      Device device = devices[0];

      // Open device, nothing can be done without doing this.
      device.Open();

      // *** DIGITAL PORTS AND ANALOG OUTPUTS ARE MODIFIED DURING THIS ***
      // *** SECTION, SO DO NOT CONNECT ANY PERIPHERALS WITHOUT STUDYING ***
      // *** THE ACTIONS DONE HERE, OTHERWISE YOUR PERIPHERALS MAY BE DAMAGED !!! ***
      //if (device.DeviceType == DeviceType.CeboLC)

      //else
      if (device.DeviceType == DeviceType.CeboStick)
      FrameIoTestStick(device);
      else
      throw new InvalidOperationException("No supported device detected.");

      // Finalize device usage, this free's up the device, so it can be used
      // again, including other applications.
      device.Close();
      }
      }
      catch (IOException ex)
      {
      Console.WriteLine(ex.ToString());
      }
      }
    • Hello,

      cebomsrnet-1.4.dll load cebomsr-1.4-x86.dll or cebomsr-1.4-x64.dll (depending on architecture) at runtime, so they must be located in any path that is checked for .dll files. This is the working directory of your application as well as all directories listed in the PATH environment variable. cebomsr-1.4-x??.dll in turn requires an additional .dll file, which must be available in one of these paths as well -> libusb-1.0-x??.dll. These should be located in the same directory as the cebomsr-1.4.x-??.dll.

      I always prefer users to use this free tool to see .dll dependencies: dependencywalker.com/. It only shows static library bindings and I don't think it works with .NET dll's, but loading cebomsr-1.4-x86.dll with this tool, shows that libusb-1.0-x86.dll is required as well,

      best regards,
      Thomas
      Software development
      Cesys GmbH
    • Thank you Thomas for the reply.

      I have add all mentioned Dlls into the debug folder of the project (there is also the dll - cebomsrnet-1.4.dll). But it still can not find the dlls. I have also tried to add the other mentioned dlls as reference to the project. There am error occured which makes mit thinking weather there is a problem with the dlls.
      It mentioned "... Please make sure that the file is accessible, and that it is accessible, and that it is a vailid assembly or COM component."

      I have tried your tip with the dependency walker. There have been some problems encountered as well.
      "Warning: At least one delay-load dependency module was not found.
      Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module."

      So still no success ;( with my projec
    • So now its 2015

      Today I tried again to use a simple console application from the examples for VS 2010 -> I have added the cebomsr-1.4-x86.dll as reference. So far no problem.
      Then I have added libusb-1.0-x??.dll in den debug directory since its not possible to add as reference.

      Still problem "Unable to load DLL 'cebomsr-1.4-x86': Das angegebene Modul wurde nicht gefunden. (Exception from HRESULT: 0x8007007E)" in den CEBO source code...

      // (c) 2013 Cesys GmbH
      // Author: Thomas Hoppe
      using System;
      using System.Collections.Generic;
      using System.Text;
      using System.Runtime.InteropServices;
      using System.IO;

      namespace CeboMsrNet
      ....

      Maybe the Software not working with .Net 2010.
      Any more ideas?
    • Hello,

      you should not add cebomsr-1.4-x86.dll as reference, only cebomsrnet-1.4.dll is required. cebomsr-1.4-x86.dll and libusb-1.0-x86.dll must be located in the startup path of your application!

      Please try the following too: Put your .exe, cebomsrnet-1.4.dll, cebomsr-1.4-x86.dll and libusb-1.0-x86.dll into one directory and start your .exe from windows explorer or a command prompt. Report what happens.
      Thomas
      Software development
      Cesys GmbH