What would be the Fortran interface to these two items:
struct m_{
int filesize[some_value]
void* filedata[some_value]
}m
In GLFW, there is an opaque struct:
typedef struct GLFWwindow GLFWwindow;
For 1
, I currently have:
type, bind(c) :: m
integer(c_int) :: filesize(some_value)
type(c_ptr) :: filedata
end type m
I am worried about losing the dimension of filedata.
For 2
, I have an empty derived type:
type, bind(c) :: GLFWwindow
end type GLFWwindow
That the type is empty worries me and does indeed produce a warning.
msz59
April 14, 2022, 7:19pm
2
void* filedata[some_value]; // Note, both struct members should end with ;
This is an array of void pointers. So why not
type, bind(c) :: m
integer(c_int) :: filesize(some_value)
type(c_ptr) :: filedata(some_value)
end type m
@general_rishkin , can you please share the declaration of some_value
on the C side?
Thanks @msz59 . This is what I tried initially but for some reason, it did not compile.
I have just tried it again now and it does compile. Strange. I must have had it mixed up with something else.
@FortranFan , the declaration is :
#define some_value 2000
However, I think I was getting confused because the first time I tried type(c_ptr) :: filedata(some_value)
, I got an error. Hence, my creating this topic post. It compiles now.