10-10-2011 03:23 AM
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*;
Solved! Go to Solution.
10-10-2011 04:03 AM - edited 10-10-2011 04:04 AM
@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.