Home/Support/Support Forum/Is there any way to ensure byte alignment of structures using Dynamic C?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Is there any way to ensure byte alignment of structures using Dynamic C?

+1 vote
I have some Windows code (Visual Studio 2013) that uses byte aligned structures:

#pragma pack(push, 1)

// Some structures

#pragma pack(pop)

They are then copied directly into a byte array using memcpy and sent over the network to the rabbit board. I want to use these same structures on the rabbit board so that I don't have to duplicate code.

Is there any way to force byte alignment in the Rabbit Board using Dynamic C?

What is the natural alignment on the Rabbit?
asked Aug 26, 2015 in Rabbit by mbermal New to the Community (40 points)

Please log in or register to answer this question.

1 Answer

+3 votes
 
Best answer
The natural alignment in DC is byte alignment as the Rabbit processors don't have any specific limitations on where multibyte values can reside.
answered Aug 27, 2015 by petermcs Veteran of the Digi Community (1,130 points)
selected Sep 14, 2015 by mbermal
Thanks for the answer. I was able to port the code and use the structures with few modifications.
...