LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

typedef struct and a linking a dll

I have a .dll that I'm trying to use in Labview with the "Call Library Function Node".

 

There is a function in this dll that uses a 'typedef struct' for it's parameter:

 

   int BACDOCrequest(bdrbag *prqst)

 

When I go to "Configure->Parameters", what do I use for type and format? I figured I would use "Adapt to Type" but since 'brdbag' is a struct, I don't know how to configure the rest. 

 

The dll author provided an example in C++.

Here is the typedef:

 

 typedef struct {
        dword    passkey;                       
        dword    request;                       
        dword    deviceid;                       
        dword    objectid;                       
        dword    propid;                          
        dword    arrindex;                      
        dword    datatype;                       
        dword    value;
        dword    errorclass;
        dword    errorcode;
        dword    priority;                       
        union {                                   
        char    sval[256];                       
        byte    bval[256];                      
        BACnetDate dval;
        BACnetTime tval;
        directaddr da;                           
        datetime dtval;                           
        HWND    listbox;                       
        bufptr    buf;                          
        Range    rg;                               
              }    aux;                           
        } bdrbag;

 

 Later on, the function is called as follows:

     bdrbag vb;

     vb.deviceid=x;

     vb.passkey=password;

     vb.request=0;

     h=BACDOCrequest(&vb);

 

 Thanks for any help you can provide!

 

Don

 

 

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

 


Don223 wrote:

 

 typedef struct {
        dword    passkey;                       
        dword    request;                       
        dword    deviceid;                       
        dword    objectid;                       
        dword    propid;                          
        dword    arrindex;                      
        dword    datatype;                       
        dword    value;
        dword    errorclass;
        dword    errorcode;
        dword    priority;                       
        union {                                   
        char    sval[256];                       
        byte    bval[256];                      
        BACnetDate dval;
        BACnetTime tval;
        directaddr da;                           
        datetime dtval;                           
        HWND    listbox;                       
        bufptr    buf;                          
        Range    rg;                               
              }    aux;                           
        } bdrbag;

 

 

 


 

 

You will want to create a cluster that has the same data and wire that up to the dll call. I'm not quite sure how LabVIEW handles unions though

Message Edited by for(imstuck) on 06-16-2010 02:26 PM
Message Edited by for(imstuck) on 06-16-2010 02:27 PM
0 Kudos
Message 2 of 4
(3,763 Views)
Here is a post by tbob that is similar. It may answer your question.
0 Kudos
Message 3 of 4
(3,755 Views)

Greg what was the result of this?  Did it work?

 

Smiley LOLSmiley Tongue:womanlol:

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