Page 1 of 1

Visual Studio 8 (2005) and api examples in xp 64

PostPosted: Mon Dec 11, 2006 12:47 am
by specsix
Attempting to get the manage api example to work. After eliminating compile errors from the api example, I did a test run. I am also using the beta x64 drivers.

Anyone else trying to do the same?

Here is the console output. Again this is not my code. This is the api managed api example output for TestApp.cs using UsbManagedWrapper.

UUIRTDRV Example Program...
===========================
An exception was thrown: System.TypeInitializationException: The type initialize
r for 'UsbUirt.Controller' threw an exception. ---> System.ApplicationException:
Unable to read UsbUirt driver version ---> System.BadImageFormatException: An a
ttempt was made to load a program with an incorrect format. (Exception from HRES
ULT: 0x8007000B)
at UsbUirt.Controller.UUIRTGetDrvInfo(UInt32& drvVersion)
at UsbUirt.Controller..cctor()
--- End of inner exception stack trace ---
at UsbUirt.Controller..cctor()
--- End of inner exception stack trace ---
at UsbUirt.Controller.get_DriverVersion()
at TestApp.Class1.RunTestApp() in J:\USB-UIRT_Dev\api_example_code(2)\UsbUirt
_rev1\UsbUirt\TestApp\TestApp.cs:line 39
at TestApp.Class1.Main(String[] args) in J:\USB-UIRT_Dev\api_example_code(2)\
UsbUirt_rev1\UsbUirt\TestApp\TestApp.cs:line 24
Press return to exit.

Any guidance would be appreciated.

Thanks

PostPosted: Wed Dec 20, 2006 5:37 am
by jrhees
Does the other example code work (the C example)?

-Jon

Solved!

PostPosted: Fri Jun 19, 2009 2:34 pm
by JasonDentler
The issue is with a 64-bit application trying to load a 32-bit DLL (uuirtdrv.dll)

To correct the problem, change each project in your solution from AnyCPU to x86. To do this, go to Build --> Configuration Manager. In the platform column, choose (New). Choose x86 from the New Platform drop down. Uncheck Create New Solution Platforms. Click OK. Back on the configuration manager window, select the new x86 option for all of your projects.

Note: You will probably need to load the managed wrapper source code as a project, reference the project, and force it to compile as x86, instead of just referencing the already-compiled UsbUirtManagedWrapper.DLL

PostPosted: Thu Jan 14, 2010 3:06 am
by jcbrooks75
I can confirm this works, Running Windows 7 64 bit and this solved the runtime exception in the managed wrapper.