> long SetData(unsigned char *pbyData, unsigned short int *wDataLength); > > - The parameter pbyData (type U8) points to a buffer that contains an > array (type U8); > > - wDataLength (int32) is the length of that array. > > What should I connect on the input of this function? Let's say I have > the array I want to feed in into this function, how do I do that? >
Double click or popup on the node and Configure. In the dialog, you need to add parameters until you have two inputs and a return value. For the return value, in the Type ring, choose Numeric -- the default will be for an I32. For the first parameter, change the name from arg1 to whatever you like, it doesn't really matter except as documentation. Then set the Type to Array. The fields below will default to I32, one dimension, and Array Data Pointer. Change the I32 to U8. For the second parameter, it should default to I32 by value. Change the name as you please, change the Type to U16, and change the Pass to be Pointer to Value. That should be it for the dialog. The Function Prototype at the bottom of the dialog should look similar to your first line above. --- To wire things up on the diagram. For the array, you will need an array of U8s. You can use a constant sized to the correct size, or you can use Initialize array to build one at runtime, or you can use Resize Array to take an existing Array and set it to the correct initial size according to what the DLL expects. There is no way for LV to know the initial assumption about the array size, you have to read the DLL documentation and set it. If you set it too small, the DLL writes past the end of the array and corrupts memory either crashing immediately, stopping the VI with an error, returning an error, or silently setting LV up to crash when things get unloaded. If you want to make certain it is the correct size, put a probe on the input wire or use execution hiliting to view the size of the input array. Wire this array to the top input on the Call Library. For the second parameter, wire up a U16, again it can be a constant, a control, or any other wire of the correct type. By the way, opening the help window, switching to the wiring or auto tool and hovering over a wire gives lots of datatype information about a wire. You can also wire the right side of the Call Library. For the moment, I'd just create indicators to view the results. If you still have problems, please be specific as to which step causes problems. Greg McKaskle
