-
Yonghong Song authored
This patch intends to fix issue #606. Currently, the key/value type information is passed from C++ to Python through a JSON interface. The JSON is constructed by traversing the struct/field's through clang AST interface. Once Python gets the JSON, it will reconstruct the C structure through ctype module. There are two known issues where Python reconstructed C structure may not be the same as the original C structure: . if user explicitly use "__attribute__ ((align))" to alter field alignment and such information is not passed to Python. . the "__int128" type is a u64[2] array in python. So in C, __int128 needs to align on 16 bytes boundary, and in Python, it aligns with 8 bytes boundary. To solve this issue, this patch provided the structure with added padding fields to Python. For example, struct { char a; __int128 b; }; Python will receive struct { char a; char __pad_1[15]; __int128 b; }; Signed-off-by: Yonghong Song <yhs@fb.com>
538a84e1