LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dll C structure

I search all the examples about how to pass the c  structure dll in LABView, but I really don't know the true answer.here is my question:
I want to use this dll which was given from my  customer.but I don't get the following data that I expected.
/*struct SDownloadInfo {
 BYTE status; // status of the  process (Eeprom Dawnload Status)
 BYTE perc;  // percentage of the process (0 - 100)
 BYTE err;  // error code (see ERR_CODE)
 BYTE nRetry; // n. attempt (1 - 3)
};
SBIT100_API SDownloadInfo GetDownloadInfo(),
the sepc. say that if the downloadinfo  is 4, the process is complete, but because this involed the SDownloadinfo,
 
I use the dll like this
but there is no correct data display,
Thanks! need your  help.
maincool
0 Kudos
Message 1 of 8
(3,437 Views)
Hi maincool,

You can send a cluster with 4 U8 elements and set the type to "Adapt to source".

A struct is basically a cluster.

Byte = u8

Make sure also that you configure the correct calling convention (C or WinAPI).

Hope this helps

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 2 of 8
(3,433 Views)
but when I use the U8 type, the dll can't export the data.
However when I set the return type be numeric, the return data is 0~4,the following cluster data is wrong,only 0 be displayed.
maincool
0 Kudos
Message 3 of 8
(3,347 Views)
My last post was nearly a year ago.

Can you post an example of your problem?

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 4 of 8
(3,346 Views)
dll C structure
maincool
Download All
0 Kudos
Message 5 of 8
(3,331 Views)
Yes ,our product has been made about one year, but sometimes the dll seems not be stability, so when I do the following action:
1.call the dll to write the eeprom file.
2.call the dll to check the eerprom file status,
I only get the status number 1~4,as i describe it before, but the struct other parameters I can't get ,all of them are "0",
the dll invoke file and setting file show  my configuration.
Thanks a lot for your help!
 
maincool
0 Kudos
Message 6 of 8
(3,331 Views)
Have you tried defining the data as a U32 and then splitting into 4 U8s after calling the DLL?

This should give you back all your data.

If you call a DLL and don't get all data back you are expecting, chances are large that you're generating a memory leak.

Try passing a single U32 and see what you get back.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 7 of 8
(3,322 Views)
Thanks a lot !Shoneill
You are right,I get the correct action and display!
But the data don't need pass anything, only split the data which got (U32) then split 4 bytee(U8), before my I only use U8,the result I ignore others three parameter..

maincool
0 Kudos
Message 8 of 8
(3,218 Views)