LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

call dll function with return type structure

Solved!
Go to solution

Hi friends.In labview i have not found any struct return type in call library function node.can any one help me?

 

this is the function im calling in labview

 

UHSDA_CONTIG_BLOCK* UHSDA_MemReq(WDC_DEVICE_HANDLE phDev, DWORD Size);

 

 

typedef struct

{

       void *pUserAddr; 

       void *pDma;       

       DWORD PhysicalAdd;

}UHSDA_CONTIG_BLOCK*;

 

 


0 Kudos
Message 1 of 2
(2,365 Views)
Solution
Accepted by topic author kavik

@kavik wrote:

Hi friends.In labview i have not found any struct return type in call library function node.can any one help me?

 

this is the function im calling in labview

 

UHSDA_CONTIG_BLOCK* UHSDA_MemReq(WDC_DEVICE_HANDLE phDev, DWORD Size);

 

 

typedef struct

{

       void *pUserAddr; 

       void *pDma;       

       DWORD PhysicalAdd;

}UHSDA_CONTIG_BLOCK*;

 

 



This is not trivial to solve. LabVIEW does not know pointer types in itself. Both the structure and the two first elements in that structure are however pointers. The easiest would be to write a wrapper function in C that you can call to convert this pointer into a more LabVIEW friendly cluster.

The alternative is to configure the return parameter to be a pointer sized integer and then use function calls to the exported LabVIEW memory manager C functions such as MoveBlock() to copy out the information you need. Searching for MoveBlock on this site will give you quite a few examples how to go about this but beware, without knowing some real C basics this is really going to be a crash exercise with little hope for a good outcome. Extra complication here is that the two embedded pointers will be differently sized on 32 bit and 64 bit Windows, so your logic to retrieve any of that information should be depending on the system bit size too.

Rolf Kalbermatter
My Blog
Message 2 of 2
(2,360 Views)