LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use wchar_t in an external dll

Hi everyone,

 

What I am trying to achieve is communicating with a USB-Device through LabView. I already got a dll plus header file, but the dll needs wchar_t. If I tell LabView to replace this with a normal char, it's not working.

I'll attach the dll and headerfile, if you could try it out and tell me, if it works for you, that'd be great. You only need the VID, PID and Serial Number from a USB-Device in your system, a mouse is sufficient.

 

To obtain these, you can e.g. use USBdeview, it's free: http://www.nirsoft.net/utils/usb_devices_view.html .

 

Any help would be greatly appreciated!

 

Thanks in advance,

 

Regards,

 

Pedro

0 Kudos
Message 1 of 4
(3,791 Views)

Hi Pedro,

 

Have you read through this tutorial which outlines how we can set up basic connectivity with USB Devices via the NI-VISA driver? Once this is set up, you should be able to make use of the device commands reference in order to perform some meaningful communication with the device.

 

In terms of the wchar_t character via the use of the DLL as a bridge of communication, this type is associated with wider characters that are assigned to the ASCII table. I think that we can either perform a Unicode to ASCII conversion within the dll, or treat this data as a variant type, or try performing a multibyte read since its width is larger than the native int.


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 2 of 4
(3,756 Views)

Hi,

 

sorry for not having answered so long. I've been in contact with the developer of said DLL and he helped me out by writing a wrapper for it. So this problem at least is solved.

 

Thanks anyway 🙂

 

Pedro

0 Kudos
Message 3 of 4
(3,743 Views)

hi,

 

Even i am facing the same problem.

the .dll which i am using requires a wchar_t const*, can u please help me  ?

0 Kudos
Message 4 of 4
(3,439 Views)