Jump to content

jsousa

Members
  • Posts

    2
  • Joined

  • Last visited

Contact Methods

LabVIEW Information

  • Version
    LabVIEW 2009
  • Since
    2007

jsousa's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hello, Thanks for your reply. I have figured out how to manipulate the data with the "Array Data Pointer" data format. It is actually quite easy. You simply need the type def for the cluster that you are passing in with the array. Then you change the void in the fct prototype created by labview to match whatever typedef you created. You can access individual elements in the array by incrementing the pointer to the array. For instance, passing in an array of simple clusters to the DLL (simple meaning just two unsigned 8 bit ints), you create the typedef in the header file and passing in say "ClusterArrayIn" with the prototype looking like so... void passClusterArray(TD1 *ClusterArrayIn) all you do is replace the void created by LV when you right click the Call Library Function Node with the Typedef defined by the type of cluster you are passing. with type def 1 being the cluster and the type def looking something like this typedef struct { uint8 num1; uint8 num2; } TD1; void passClusterArray(TD1 *ClusterArrayIn) { (ClusterArrayIn+1)->num1 = 10; (ClusterArrayIn+1)->num2 = 11 } There may be an easier way to manipulate the data but this isn't too bad. It just took a while to figure out how to do this because the documentation on it is not great. Also, you must pass in the length of the array as a separate argument. But that is easy because you can pass that by value! Thanks for the assistance
  2. Hello, I am attempting to send an array of clusters from LV to a C/C++ DLL written in MS Visual C++ 2010. The clusters have strings (LV strings converted to U8 Char Arrays) and an integer (representing the size of the U8 Char Arrays). The process I went through was to create the array of clusters and then send the array as an input to the call library function node along with an I32 representing the number of elements in the array (2 for now to keep it simple). I selected Adapt To Type as the data type and am not sure which data format to use. I have created a skeleton c file for both Array Data Pointer and Handles By Value (array data pointer is apparently a newer feature). Looking at the skeleton .c file created with Array Data Pointer as the format...it is fairly blank and has void as the data types. With Handles By Value, the C code looks similar to the C file created by sending the array into a CIN and creating a skeleton c file that way. I am having difficulty understanding how to manipulate the LV data in the DLL file with the typedefs created by labview (I just copied over the skeleton c file typedefs to the dll) and was wondering if anyone could explain to me the best way to manipulate the data and if I should use Handle By Value or Array Data Pointer for the data format (I am fairly new to C/C++). Here are the typedefs created by labview with the Handles by Value or with the array going into a CIN: /* Typedefs for array of clusters with strings */ typedef struct { int32 dimSize; uInt8 elt[1]; } TD3; typedef TD3 **TD3Hdl; typedef struct { TD3Hdl unsignedByteArray; int32 elt2; } TD2; typedef struct { int32 dimSize; TD2 elt[1]; } TD1; typedef TD1 **TD1Hdl; I imagine dimSize for TD1 is the size of the array (so maybe I don't have to pass that into the fct as a separate argument?) and that dimSize for TD3 is the size of the U8 char array. Does TD3Hdl represent a handle to the individual unsignedByteArrays? Any help would be greatly appreciated. Thanks very much
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.