Hi all,
 
---------------8><----------------------------------------------------------
>How to use structures in SDCC?

Just like you normally would.

> More specifically, is it possible to pass a pointer to a structure as
function parameter? If yes, how?

Just like that, as long as it is a pointer.

> (SDCC doc says it is not possible to pass structures as function
parameters. Does this restriction apply to pointers to structures also?)

No.

---------------8><------------------------------------------------------

Thanks Johan for your fast response. With some amount of permutation and combination I was able to get the structures compiled. The following is what works for me :
 
/*--------EEFIFO.h------------------------*/
 
//unsigned int eefifo_size(struct eefifo *fifo);
 
/*-------EEFIFO.c-----------------------*/
struct eefifo
{
     int  start;
     int  end;
     char rec_size;
     int  putptr_add;
     int  getptr_add;
     int  max_size;
     char residue;
     int  act_end;
};
 
code struct eefifo fifo1 = { 0x0080, 0x7eff, 0x10, 0x0006, 0x0008, 0x07e8, 0x00, 0x7eff };
 
unsigned int eefifo_putptr, eefifo_getptr;
 
unsigned int eefifo_size(struct eefifo *fifo)
{
 
 eefifo_putptr = EE_read_int(fifo->putptr_add);
 eefifo_getptr = EE_read_int(fifo->getptr_add);
 
 if (eefifo_putptr == eefifo_getptr)
      return(0x00);
 else if (eefifo_putptr > eefifo_getptr)
      return ((eefifo_putptr - eefifo_getptr) / fifo->rec_size);
 else if (eefifo_putptr < eefifo_getptr)
     return (fifo->max_size - ((eefifo_getptr - eefifo_putptr) / fifo->rec_size));
 
}
/*--------------myfile.c--------------------*/
 
#include EEFIFO.h
#include EEFIFO.c
 
main( )
{
    unsigned int x;
......
    x = eefifo_size( &fifo1)
.......
 
}
 
With the prototype of eefifo_size uncommented I get an error message "Actual Argument type different from declration 1" pointing to the closing braces of the function eefifo_size.
 
With the prototype commented out the function compiles properly.
 
I am using SDCC 2.2.1 winbinaries on NT 4 box.
 
 
Visit us at www.pulsars.com
 
What should you do if you see an endangered animal eating an endangered plant?