I need the following construct:
// Header file
typedef fc_t (*comdevCbackIsReady_t)(const comdev_t* const module);
typedef struct
{
comdevCbackIsReady_t cbIsReady;
} comdev_t;
This wont compile, because the comdevCbackIsReady_t
function pointer type does not know the comdev_t
struct type. If I exchange these 2 places, then the struct wont know the func pointer type. My current way around this is declaring the comdevCbackIsReady_t
input parameter as void*
instead. This is not very clean. Is there a way to somehow "forward declare" one of these?
EDIT this wont compile:
// Header file
struct comdev_t;
typedef fc_t (*comdevCbackIsReady_t)(const comdev_t* const module);
typedef struct
{
comdevCbackIsReady_t cbIsReady;
} comdev_t;
The comdev_t
is still an unknown type for the comdevCbackIsReady_t
.