This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

compiler expecting an expression with func pntrs

Hello all,

I am porting 'C' code from another Cortex-M project to the Keil uVision (V4.72.10.0). This code made liberal use of function pointers, which were happily compiled by the other build system. However, the Keil uVision IDE will not compile this part of the code and complains with the following error: ..... error: #29: expected an expression

The following snippet is given:

struct dpi_system_driver *system_drv = dpi_system_get_driver();

int dpi_system_initialize(struct dpi_system_driver *drv, int *error) {

return (*(drv->initialize))(void); <=== produces error #29
}

The following definitions are given:

struct dpi_system_driver { int (*initialize)(void);
};

static struct dpi_system_driver __lbstr_system_driver = {

.initialize = lbstr_system_initialize,
};

struct dpi_system_driver *dpi_system_get_driver(void) { return &__lbstr_system_driver;
}

int lbstr_system_initialize(void) {

< lines of codes >

return 0;
}

I would have expected this line to compile since the other build system accepted it. Would anyone have any ideas to assist me. Perhaps I need to add a "long option" to the compiler command line.

0