GCC pointer to callback function error.

May 11, 2008
23,331
1,575
126
Hi, I am trying to port an xmodem function to my own program.
I am using GNU GCC.

I think the compiler does not understand what i try to do.
That it requires a different kind of notation. I googled for it but i am unable to find what i am looking for.

This is the error :
In file included from src/xmodem.c:4:
./inc/xmodem.h:54: error: expected ')' before '(' token
./inc/xmodem.h:55: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xmodem_crc_check'
src/xmodem.c:14: error: expected ')' before '(' token
src/xmodem.c:163: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xmodem_crc_check'
make: *** [src/xmodem.o] Error 1

This is the code from my header file :
Code:
line 53 // Function prototypes 
line 54 xm_err_t xmodem_receive(bool (*callback)(void *p_args), uint32_t offset);
line 55 bool xmodem_crc_check(uint8_t crcflag, const uint8_t *pbyte, uint16_t len);
line 56 uint16_t xmodem_crc_calc(uint8_t crcflag, const uint8_t *pbyte, uint16_t len);

This is a part of the source code :
Code:
// ******************************************************************************
// xmodem_receive
// ******************************************************************************
xm_err_t xmodem_receive(bool (*callback)(void *p_args), uint32_t offset)
{
  uint8_t c, retry = XM_RETRY_LIMIT, response = 'C', crcflag = 0, xm_pkt_num = 1;
  uint16_t i, timeout, xm_pkt_size;
  uint32_t ofs = offset;

Does anybody know what i am doing wrong ?