I have an application in Visual Studio 2015 that receives a certain struct, as a memory pointer, with some fields from an application in LabWindows CVI that writes in a socket. Then I recast the memory into the same struct in my application. Code looks like:
DT_ULLong data;
wait_msg(...,...,&data);
XC_GEN_MSG* gen_msg = (XC_GEN_MSG*)data;
float var = gen_msg->varFloat;
//var has trash values
...
Structures:
typedef struct _XC_GEN_MSG
{
XC_SERVER_MSG_HEADER Header;
DT_ULong data; //unsigned long long int
} XC_GEN_MSG;
typedef struct
{
unsigned char word[8];
unsigned int num_image;
unsigned int num_pixels_az;
unsigned int num_pixels_dist;
unsigned int rawtime_ms;
unsigned int rawtime_time_t;
unsigned int PW;
unsigned int PRI;
unsigned int Range;
unsigned int PW_Digit;
unsigned int Integrated_pulses_AZ;
unsigned int Rotation_time;
unsigned int bytes_per_pixel;
unsigned int bytes_digit;
DT_UEncoder UD_AZ_RESOLUTION; // typedef unsigned short DT_UEncoder;
float f_az_resolution;
unsigned int Status_bitfield;
float Lat;
float Long;
float wind_speed;
float wind_direction;
float speed;
float course;
unsigned int comand;
unsigned int valor_comand;
} XC_SERVER_MSG_HEADER;
All the fields are correctly casted and I can see the proper values, but the float fields (varFloat in this case) are always with trash (usually close to 0, but sometimes for example 2*e24). I guess this can be due to compilation problems or memory copy ones, but the interesting part is that it works in the 32 version of the application but not in the 64 version of it.
Where could be the problem and how can I solve it?
Thanks!