ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pointer to struct in call library function

I have a dll function with this prototype:
DWORD CAN_Read(TPCANMsg* pMsgBuff);
where TPCANMsg is a structure.
typedef struct{
DWORD ID;
BYTE MSGTYPE;
BYTE LEN;
BYTE DATA[8];
}TPCANMsg;
I create a cluster that is represented as a structure. But in Call Library Function witch do I have to choose: "Handles by Value" or "Pointers to Handles"?
0 Kudos
Message 1 of 5
(3,430 Views)
If you are calling the function above, you will need to use Pointers to Handles because this particular function is using a pass by reference variable (pointer) to send the TPCANMsg datatype.
J.R. Allen
0 Kudos
Message 2 of 5
(3,430 Views)
> I have a dll function with this prototype:
> DWORD CAN_Read(TPCANMsg* pMsgBuff);
> where TPCANMsg is a structure.
> typedef struct{
> DWORD ID;
> BYTE MSGTYPE;
> BYTE LEN;
> BYTE DATA[8];
> }TPCANMsg;
> I create a cluster that is represented as a structure. But in Call
> Library Function witch do I have to choose: "Handles by Value" or
> "Pointers to Handles"?

The key is to make sure the type is set to Adapt. The setting of the
Data Format shouldn't matter since your datatype doesn't have a string,
array, path, or other nonflat data element.

for the DATA[8], you will want to use eight inline U8s, or a cluster of
the bytes.

The info I'm going on is the LV External Code manual.

Greg Mckaskle
Message 3 of 5
(3,430 Views)
Thank you so much for this answer. It really helped me.
Flavia
0 Kudos
Message 4 of 5
(3,430 Views)
Thank you so much for your answer. I did what you said and it worked very well.
Flavia
0 Kudos
Message 5 of 5
(3,430 Views)