C Structure (Keil Compiler)

Discussion in 'Embedded Systems and Microcontrollers' started by bctang, Dec 30, 2007.

  1. bctang

    Thread Starter Member

    Sep 5, 2004
    26
    0
    Code ( (Unknown Language)):
    1. /* ----------------------------------------------------------------------
    2.  * DECLARE your own open(), close(), addr(), and byte() routines here.
    3.  *
    4.  */
    5.  
    6. static int open1(), close1(), addr1(), byte1();
    7. static int open2(), close2(), addr2(), byte2();
    8. static int open3(), close3(), addr3(), byte3();
    9. static int open4(), close4(), addr4(), byte4();
    10.  
    11. /* ----------------------------------------------------------------------
    12.  * ADD an entry to this table to register your
    13.  * output format routines. Give your object format
    14.  * a name to be specified with the -F option.
    15.  *
    16.  */
    17.  
    18. static int format;
    19. static struct {
    20.    char *name;
    21.    int (*e_open)();
    22.    int (*e_close)();
    23.    int (*e_addr)();
    24.    int (*e_byte)();
    25. } formtab[] = {
    26.    { "tdr",   open1, close1, addr1, byte1 },
    27.    { "byte",  open2, close2, addr2, byte2 },
    28.    { "od",    open3, close3, addr3, byte3 },
    29.    { "srec2", open4, close4, addr4, byte4 },
    30.    { "srec3", open4, close4, addr4, byte4 },
    31.    { "srec4", open4, close4, addr4, byte4 }
    32. };
    33.  
    34. #define FORMTABSIZE   (sizeof(formtab)/sizeof(formtab[0]))
    Hi,

    Above the structure declared the function in structure. This sample code is picked from other sample project code.

    The call functions:
    Code ( (Unknown Language)):
    1. (*formtab[format].e_open)(file,ftype,arg);
    2. (*formtab[format].e_close)();
    3. (*formtab[format].e_addr)(a);
    4. (*formtab[format].e_byte)(b);
    I'm using Keil compiler. I had tryed put this code in my compiler but compiler show few warning, ex:
    WARNING L2: Reference Made to Unresolved External
    SYMBOL: Byte1


    How to remove the warning?

    Please help me....

    Thank you.
     
Loading...