Announcement

Collapse
No announcement yet.

USB2DLL USB2TestIsRunning() Issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • USB2DLL USB2TestIsRunning() Issue

    I am using your USB2DLL API via C# and it appears that USB2TestIsRunning() always returns true regardless of whether or not its actually still running. I have run the C++ sample application and USB2TestIsRunning() seems to work as expected there.

    If it is of any help, the DLLImport declaration in my C# application is as follows:
    [DllImport("USB2Dll.dll", CallingConvention = CallingConvention.Cdecl)]
    publicstaticexternbool USB2TestIsRunning();

  • #2
    We've found that loading the DLL like this

    [DllImport("USB2Dll.dll")]
    [return: MarshalAs(UnmanagedType.I1)]

    should return an expected value of false when the test isn't running. According to this post it's due to the way C defines bool as 4 bytes, C++ as 1 and C# uses 4 bytes (and the DLL is C++).

    Comment

    Working...
    X