I have a header file with a type definition like this
#ifndef SETSIZE
#define SETSIZE 32
#endif
typedef struct _set {
unsigned array[SETSIZE];
} set_t;
To use a corresponding C-function I need to have the set_t type available in Ada. The problem is that SETSIZE is a configurable parameter (with default value 32). If I understand it correctly I cannot access preprocessor defines from Ada. Would it be possible to add a constant to the c-file and use this in Ada like this:
#ifndef SETSIZE
#define SETSIZE 32
#endif
const size_t test = SETSIZE;
// Alternative
enum { test2 = SETSIZE };
--Ada--
-- import test somehow
type set_array is array (0 .. test) of aliased Interfaces.C.unsigned;
type set_t is record
array_field : aliased set_array;
end record;
Or any other way to have this type correctly available in Ada without too much change in the original C-code