LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to do with a pointer element in a structrure when I call a dll in labview

struct ZT_USBBOARD
{
long lIndex;
HANDLE hHandle;
short nCh;
long lData;
long* plData;
long lCode;
};


FUNCTION:long APIENTRY OpenUSB7kC (ZT_USBBOARD* bs)
---open the device USB7310
the valid input parameter:1Index


There,how to do with 'HANDLE hHandle' and 'long* plData 'in a cluster of labview? DO you understand?
WAITING....Thinks!
0 Kudos
Message 1 of 7
(2,642 Views)
Structs can be handled by using Adapt to Type, just build the cluster and wire it in. Pointers can be handled as intergers and passed on.
Did you read Using External Code in LabVIEW? If not, go to Help>>Search the LabVIEW bookshelf.
You can find some more DLL related material here.

___________________
Try to take over the world!
Message 2 of 7
(2,637 Views)
Thanks! I read the articles and examples that you said before.but I haven't found the answer.I know I should use the cluster,but in the cluster,how to do with 'handle'?
0 Kudos
Message 3 of 7
(2,624 Views)
If I remember correctly what I have read about this, you can't use the handles themselves in LV, but can only pass them on to other DLL functions. I know that for windows API DLLs this works fine - you define the handle as a U32 and just pass it on to the next function.
I'm not 100% positive that this is so, but as far as I can remember that's what I read.

___________________
Try to take over the world!
0 Kudos
Message 4 of 7
(2,618 Views)
Just to clarify, I believe that you can get the values the pointers are pointing to if you use Adapt to Type and Handles by Value, but I don't know if you can use the pointers themselves for anything.

___________________
Try to take over the world!
0 Kudos
Message 5 of 7
(2,616 Views)
Thank you very much!
The problem has been solved.The reason can be the choice of 'stdcall' and 'c'!But a new problem appeared.The program is normal when it runs first,but it is abnormal when it runs again and labview is closed.what can I do?
0 Kudos
Message 6 of 7
(2,605 Views)
Well, I'm not entirely sure what your function does, but if it opens a connection to a hardware resource (USB?), you should probably close that connection before trying to open it again, using whatever function was supplied. It may be corrupting your memory.
Also, make sure you're using the proper representations for your types, because this can also cause some overwriting.

___________________
Try to take over the world!
0 Kudos
Message 7 of 7
(2,597 Views)