1. GNUC사용시 구조체 멤버 얼라인먼트
- 구글 검색 키워드 : arm gcc pragma pack
ARM Compiler toolchain Compiler Reference - #pragma pack(n)
Is gcc's __attribute__((packed)) / #pragma pack unsafe?
6.60.8 Structure-Packing Pragmas
- 구글 검색 키워드 : gnuc pragma push
사용예
#if defined (__GNUC__)
#define MY_LIB_BEGIN_PACK1 _Pragma("pack(push,1)")
#define MY_LIB_END_PACK _Pragma("pack(pop)")
#endif
MY_LIB_BEGIN_PACK1
typedef struct _my_struct1
{
unsigned char field1;
short field2;
int field3;
} my_struct1_t;
typedef struct _my_struct2
{
unsigned char field1;
int field2;
int field3;
} my_struct2_t;
MY_LIB_END_PACK
'programming' 카테고리의 다른 글
안드로이드 개발 자료모음 (0) | 2022.02.01 |
---|---|
GPIO - 버튼처리 (0) | 2020.08.08 |
Gradle을 이용해 만든 자바 프로그램 실행시 "Could not find or load main class 클래스이름"에러 발생 (0) | 2017.08.04 |
Visual Studio 안드로이드 에뮬레이터 - Unable to determine the host ip address에러 (0) | 2017.05.18 |
winsock2.h에 있는 qos.h파일을 못 찾는 에러 (0) | 2017.05.06 |