04-08-2010 04:16 PM - edited 04-08-2010 04:20 PM
I'm kind of surprised by this. If I compile ANY of the xnet examples that include nixnet.h with "Build with C99 extensions" enabled, nixnet.h will not compile with the following error:
"Types based on variable length arrays are illegal in structs or unions".
Why is this? How is it that the new XNET API isn't able to compile with C99 extensions?
Given that I've used some C99 extensions in other parts of my code, I'm now stuck. If I have to back out those changes, it requires more time to rewrite code that is otherwise working fine.
04-09-2010 07:22 AM
Does the warning indicate a line number?
What compiler are you using?
I just tried to compile in a gcc version with -std=c99 and I did not get this error.
04-09-2010 09:19 AM - edited 04-09-2010 09:26 AM
I am guessing that you are using CVI... for a workaround, you can edit the nixnet.h file and replace lines 1889-1901 which are:
typedef nxFrameFixed_t(8) nxFrameCAN_t;
typedef nxFrameFixed_t(8) nxFrameLIN_t;
typedef nxFrameFixed_t(1) nxFrameVar_t;
with
typedef struct nxFrameCAN_t
{
nxTimestamp_t Timestamp;
u32 Identifier;
u8 Type;
u8 Flags;
u8 Info;
u8 PayloadLength;
u8 Payload[8];
} nxFrameCAN_t;
typedef struct nxFrameLIN_t
{
nxTimestamp_t Timestamp;
u32 Identifier;
u8 Type;
u8 Flags;
u8 Info;
u8 PayloadLength;
u8 Payload[8];
} nxFrameLIN_t;
typedef struct nxFrameVar_t
{
nxTimestamp_t Timestamp;
u32 Identifier;
u8 Type;
u8 Flags;
u8 Info;
u8 PayloadLength;
u8 Payload[8];
} nxFrameVar_t;
04-09-2010 09:23 AM - edited 04-09-2010 09:25 AM
If you are using NI-XNET 1.0 (my prior information was for 1.1), then the lines are 1614 and 1615 and you would replace them with
typedef struct nxFrameCAN_t
{
nxTimestamp_t Timestamp;
u32 Identifier;
u8 Type;
u8 Flags;
u8 Info;
u8 PayloadLength;
u8 Payload[8];
} nxFrameCAN_t;
typedef struct nxFrameVar_t
{
nxTimestamp_t Timestamp;
u32 Identifier;
u8 Type;
u8 Flags;
u8 Info;
u8 PayloadLength;
u8 Payload[8];
} nxFrameVar_t;
04-09-2010 11:27 AM - edited 04-09-2010 11:28 AM
04-09-2010 12:16 PM