I have a simple C structures that I want to make visible in Python interpreter:
struct OpenFile {
int modified;
const char *filename;
};
typedef struct OpenFile OpenFile;
struct OpenFiles {
OpenFile *open_files;
int count;
};
typedef struct OpenFiles OpenFiles;
Then I have a C function that allocates, populates and returns OpenFiles type:
OpenFiles get_open_files();
How should I expose the data in the interpreter?
I'm thinking about a readonly module attribute open_files
that would be calling the above function on each access (the operation is cheap, no worries). However I don't know how to implement it?