Home/Support/Support Forum/__attribute__((ms_struct)) for bit fields
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

__attribute__((ms_struct)) for bit fields

0 votes
I'm trying to port some code from a Windows device driver to NET+OS. I have several structures that map to registers, per the following sample:

//////////////////////////////////////////////////////////////////////
typedef struct
{
unsigned char _1 : 1;
unsigned char _2 : 1;
unsigned char _3 : 1;
unsigned char _4 : 1;
unsigned char _5 : 1;
unsigned char _6 : 1;
unsigned char _7 : 1;
unsigned char _8 : 1;
}
__attribute__((__packed__))
__attribute__((ms_struct))
STRUCT_1;

STRUCT_1 s_1;

memset (&s_1, 0, sizeof (s_1));
s_1._1 = 1;

UCHAR * p = &s_1;
//////////////////////////////////////////////////////////////////////

Here's my problem:

// * p == 0x80 // NET+OS
// * p == 0x01 // Windows

When I compile the code above, the compiler tells me:
'ms_struct' attribute directive ignored

Does anyone know how to enable it?
asked Jan 6, 2010 in NET+OS by burl New to the Community (17 points)
recategorized Nov 26, 2013 by tuxembb

Please log in or register to answer this question.

5 Answers

0 votes
What does this have to do with iDigi Platform? Which Digi hardware are you using? What version of NET+OS?
answered Jan 6, 2010 by Admin Veteran of the Digi Community (732 points)
0 votes
Sorry,

Digi ESP for NET+OS
Version: 1.3.0
Build id: 10192007 NET+OS 7.3
ConnectCore 9P 9215
answered Jan 6, 2010 by burl New to the Community (17 points)
0 votes
I moved the thread to a more appropriate forum. Hopefully you'll get an answer here...
answered Jan 7, 2010 by Admin Veteran of the Digi Community (732 points)
0 votes
I've never run into this before, but google reveals:

http://developer.apple.com/mac/library/documentation/DeveloperTools/gcc-4.0.1/gcc/Variable-Attributes.html

This might work?
answered Jan 29, 2010 by mcarver Community Contributor (108 points)
0 votes
I ended up just changing my logic, but thanks for the tip.
answered Jan 29, 2010 by burl New to the Community (17 points)
...