LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Call DLL function with pointer to simple struct

Solved!
Go to solution

Hello,

I try to call a function using CLFN. My problem is the parameters of the function I try to access.

Here is the function and his parameter:

typedef struct {
	int major;
	int minor;
	int revision;
	int build;
} VersionNumberType;

int Comm_BTE_softVersion( VersionNumberType *pVersion) 
{
  BYTE byBuffer[2048] ;

 if( !Comm_BTE_readYMem( byBuffer,COMM_BTE_TX14_SOFTVERSIONADDR,
   		         COMM_BTE_TX14_SOFTVERSIONSIZE))
 {
	return FALSE ;
 }

  //. process the answer
  pVersion->major = (int) (byBuffer[0] & 0xFF) ;
  pVersion->minor = (int) (byBuffer[1] & 0xFF) ;
  pVersion->revision = (int)( byBuffer[2] & 0xFF) ;
  pVersion->build = (int) ((int) ( byBuffer[4] << 8) ) | ((int) ( byBuffer[5] ));

      return TRUE ;
} //. end Comm_BTE

 

 In attached file there is the Comm BTE soft Version.vi that try to access this function. The code crashes when the function is called and labVIEW is closed.

I probably don't pass the data parameters correctly to the CLFN.

 

Thanks for help.

Regards. NewCLAD.

0 Kudos
Message 1 of 3
(3,111 Views)
Solution
Accepted by topic author NewCLAD

Everything is configured correctly EXCEPT the numeric representation of the values in the cluster. They must match int, which is most likely 32 bits on your platform. In your VI, they are U8.

0 Kudos
Message 2 of 3
(3,073 Views)

Thank you nathan,

 

It seem's that everything's working properly now. 

Best regards

0 Kudos
Message 3 of 3
(3,027 Views)