LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

calling structure in dll

I have read through many post but I think I didnot get my answer.
I want to call a dll which has following structure and function.
 
/////////////////////////////////////////////////////////////////////////
typedef struct
{
 int id;
 int len;    
unsigned char data[8]; 
 double freq_in_s;  
} Periodic_buffer;
 
int STDCALL CAN232_Set_Periodic(Periodic_buffer);
//////////////////////////////////////////////////////////////////////////////////
 
How do I call this function using call library function node?
 
I tried creating a cluster but it gives me error 1097. I created a cluster with 2 I16 (id and len), 1 array of U8 with 8 elements and 1 double.
 
I know this is a good dll and it works with CVI.
 
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 1 of 4
(3,000 Views)

Any LV experts outthere?

Happy Holidays and Merry Christmas to ALL!

Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 2 of 4
(2,965 Views)
Sheetal,

As you have noticed getting structs in DLLs and LabVIEW clusters to work can be difficult at times.  There are a few suggestions that I would make.  First of all, are you trying to pass a struct using the cluster type in LabVIEW?  If so, I might suggest using the Adapt to Type data type to see if you get any better results that way.  If you can't get that working, you may consider creating a wrapper DLL that converts the individual components of the struct into the actual data type and returns that.  You could call that in LabVIEW which in turn calls your DLL. 

Let me know if you have any questions.  Thanks!
Andy F.
-----------------------------------------------------------------
National Instruments
0 Kudos
Message 3 of 4
(2,931 Views)

Sheetal,

In addition to what Andy suggested you could look through Rolf Kalbermatter's postings here.

http://forums.ni.com/ni/tracker?user.id=6528

He has covered most of the bases with dll calls and that I where I would look first. Smiley Surprised

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 4
(2,926 Views)