LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Attempting to create shared dll for WINUSB.dll

I'm attempting to create a shared .dll in LabVIEW 8.5 for winusb.dll.  I have installed WINDDK v.6001.18002.  I specify the winusb.dll from \windows\system32\winusb.dll, and the header from \WinDDK\6001.18002\inc\ddk\WINUSB.h.  The dll generation fails and calls for additional header files: usb.h and initguid.h (both found in \WinDDK\6001.18002\inc\api).  When I attempt to add this path to the Include Path the DLL generator doesn't proceed.  What am I doing wrong?  Should I combine all the .h into one big file?  All the functions are visible when I do not include the \inc\api path but I get messages like this:

WinUsb_AbortPipe(
    IN  WINUSB_INTERFACE_HANDLE InterfaceHandle,
    IN  UCHAR PipeID
    );

The following symbols are not defined:
UCHAR; IN;

Undefined symbols can prevent the wizard from recognizing functions and parameters. To correct this problem, check the header file to determine if you must add predefined symbols. Click the Back button to return to the previous page of the wizard to add a predefined symbol (for example, "NIAPI_stdcall = __stdcall" or "NIAPIDefined = 1").

The following header file was not found in the specified header file or one of the referenced header files:
-  usb.h
-  initguid.h

To fix, click the Back button to go to the previous page and add the header file path to the Include Paths list.

 

Is this a bug or am I doing somthing wrong?

 

Thank you.


Alex G.

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

Please! The LabVIEW Shared Library import Wizard is NOT a full C parser. You are trying to throw the Windows DDK headers in its face, something even most C compilers will simply joke on unless they come from Microsoft and their entire environment has been carefully prepared by first running the installer that takes care of a lot of behind the scene vodoo, then running the DDK batch file that setups the environment variables for the compiler environment. None of these preparations will be seen by the Shared Library import Wizard and replicating it all on your own is almost an impossible task. Also the DDK headers contain C syntax elements that are very compiler specific.

 

You have really only two options here: well three if you consider the option to just drop this task.

 

1) To destile your own header file for the APIs you want to import and try it then. This header file should strictly contain only the definition that are needed for the APIs in question.

 

2) Forget about the Shared Library Import Wizard and just start creating those VIs yourself, figuring out the correct configuration of the Call Library Nodes manually.

 

Personally I would go for option 2 and be prepared that the API in question might contain things that are very difficult or even impossible to deal with from the Call Library Node directly. This would mean you can't get away without writing a wrapper DLL in C, that translates between your WinUSB API anda more LabVIEw friendly API.

 

Good luck.

 

Rolf Kalbermatter

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 3
(4,375 Views)

Thanks for the info.  I misunderstood the functionality of the Wizard.  I thought it was a full Microsoft compatible C parser.  I guess I will have to either create the wrappers, as you say, or attempt direct USB communication with the custom device I'm trying to communicate with in LabVIEW.

 

Alex

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