-
-
Notifications
You must be signed in to change notification settings - Fork 65
Description
I've noticed that the ordering of the class definitions and code is not always identical for the same header file. This is causing problems with version management of the generated code. My assumption was that the generated ctypes code follows the order of the C header file. I can't share the exact example here, but I'll try to show a sort of equivalent below.
#include "STRUCT1.h"
#include "STRUCT2.h"
typedef struct { .. } STRUCT3;
typedef struct {
STRUCT1 var1;
STRUCT2 var2;
STRUCT3 var3;
} COMBINED_STRUCT
In the generated .py code I expect to see the generated code in the same order that they are referenced above:
STRUCT3
STRUCT1
STRUCT2
COMBINED_STRUCT
However, sometimes I see:
STRUCT3
STRUCT2
STRUCT1
COMBINED_STRUCT
In both cases the code the functional, but like I said - it's causing a problem for reproducible builds and thus the version control system.
I thought maybe a dictionary is being used to store the various nodes for code generation, and the code is generated by iterating thru the keys in the dictionary. However, since Python 3.7, dictionaries preserve insertion order (and I'm using 3.10.x) - so that shouldn't be the root cause.
Could this be an issue with the clang package? Is there any intermediate data structures I could provide to determine the root cause of this?
Thanks!