From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Transfering a struct in a struct form LabVIEW to a dll and get it back to LabVIEW

Hi everyone,
 
actually I've a big problem.
I'm calling a dll function through LabVIEW. The called function is defined isw defined as followed:
fcbGetEnumFlexCards( fcInfo** pInfo);
 
fcInfo is a struct:
typedef struct fcInfo
{
fcDword FlexCardId;
fcVersion Version;
fcInfo* pnext;
} fcInfo;
 
The Parameter fcDword is an unsigned int 32, but the Parameter Version which is decleared as fcVersion is also a struct:
 
typedef struct fcVersion
{
fcVersionNumber BaseDll;
fcVersionNumber DeviceDriver;
fcCCtype CCType;
fcDword Reserved[4];
} fcVersion;
 
but the next Problem is that the fcVersionNumber declaration is also a struct:

typedef struct fcVersionNumber

{

fcDword Major;

fcDword Minor;

}fcVersionNumber;

My first thought to solve the Problem was to build a cluster in a cluster, in a cluster and then pass it to the C-Function.

That worked without any Problem, but all defined Parameters in the Cluster were still unwritten except the first one?!

But I know that all the other parameters should be written too?

Is ´there any possibility to solve this probleme through LabVIEW?

 

Thanks for helping....

0 Kudos
Message 1 of 2
(2,171 Views)
LabVIEW uses a dynamic memory manager. If you refer to a cluster, the memory of that cluster might (probably will) be released, because it's not needed by LabVIEW anymore.


If you need consistent memory, you'll have to force it:


1) You could write a c/c++ dll to do that for you.
2) You can use windows heap function to get memory, and then copy the structure to it.
3) You can also use LabVIEW.exe export functions like AZNewPClr.


It's not simple stuff though.


Regards,


Wiebe.


"chrislambert@web.de" <x@no.email> wrote in message news:1153473008020-394429@exchange.ni.com...
Hi everyone,
&nbsp;
actually I've a big problem.
I'm calling a dll function through LabVIEW. The called function is defined isw defined as followed:
fcbGetEnumFlexCards( fcInfo** pInfo);
&nbsp;
fcInfo is a struct:
typedef struct fcInfo
{


fcDword FlexCardId;
fcVersion Version;
fcInfo* pnext;
} fcInfo;
&nbsp;
The Parameter fcDword is an unsigned int 32, but the Parameter Version which is decleared as fcVersion is also a struct:
&nbsp;
typedef struct fcVersion
{


fcVersionNumber BaseDll;
fcVersionNumber DeviceDriver;
fcCCtype CCType;
fcDword Reserved[4];
} fcVersion;
&nbsp;
but the next Problem is that the fcVersionNumber declaration is also a struct:


typedef struct fcVersionNumber



{



fcDword Major;


fcDword Minor;


}fcVersionNumber;


My first thought to solve the Problem was to build a cluster in a cluster, in a cluster and then pass it to the C-Function.


That worked without any Problem, but all defined Parameters in the Cluster were still unwritten except the first one?!


But I know that all the other parameters should be written too?


Is ´there any possibility to solve this probleme through LabVIEW?


&nbsp;


Thanks for helping....
0 Kudos
Message 2 of 2
(2,156 Views)