I am working on a library designed to work with fortran allocated memory in C.
I want to add support for the derived types. For that I need an equivalent type hardcoded in C, that is what a library requires. What is the best way to automate it?
Example:
type, bind(c) :: coordinatesfloat
real(c_float) :: x
real(c_float) :: y
end type coordinatesfloat
to
typedef struct coordinatesfloat {
float x;
float y;
} coordinatesfloat;
I have seen tools like f2c, but it feels too much to introduce a dependency just for type "conversion". Is writing a script a better idea? How would an interface for registering a type look like?