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

Problem with assigning the address of a function to a LIB-variable

I have written a LIB with the following decleration:

  idata u_char clock_occ;
  idata void (*f_ce)(u_char stat);

I use it in the LIB in the way as:

  clock_occ = 1;
  f_ce(TRUE);

so far, no problem, I compile it -> ok:

I add the LIB to my project and use it like:
 
  extern idata u_char clock_occ;
  extern idata void (*f_ce)(u_char stat);

  void SetChipEnable (u_char stat)
  { ... }

  void main (void)
  {
    clock_occ=0;
    f_ce = (void *)SetChipEnable;
  }

-> now I get at the use of "clock_occ" no error, but at the use of "f_ce" I get the warning "1" + "2" (unresolved ex. sym.)

Why?

Many thank's for help.

Norbert Christof

Parents
  • Thanks. I have made this solution:


    In my "lib"

    
    defTyp idata void (code*f_ce_on)();  
    defTyp idata void (code*f_ce_off)();  
    
    
    void InitClockLib (u_char *p_ce_on, u_char *p_ce_off)
    {
    	f_ce_on = p_ce_on;
    	f_ce_off = p_ce_off;
    }
    
    

    .... in a function of the "lib"

      	MCO = 1;
            f_ce_on();
    

    the using code:

    
    void SetChipEnableOn (void)
    {
      P2 = 0xFF;
    }
    
    void SetChipEnableOff (void)
    {
     P2 = 0;				
    }
    

    ... and

    
    InitClockLib ( (u_char*) &SetChipEnableOn, (u_char*) &SetChipEnableOff);
    
    

    In the Overlay ... I have to write

    Read ! (SetChipEnableOn, SetUhrChipEnableOff),
    Write ! (SetChipEnableOn, SetUhrChipEnableOff)
    
    

    Thank for your Help

    Norbert

Reply
  • Thanks. I have made this solution:


    In my "lib"

    
    defTyp idata void (code*f_ce_on)();  
    defTyp idata void (code*f_ce_off)();  
    
    
    void InitClockLib (u_char *p_ce_on, u_char *p_ce_off)
    {
    	f_ce_on = p_ce_on;
    	f_ce_off = p_ce_off;
    }
    
    

    .... in a function of the "lib"

      	MCO = 1;
            f_ce_on();
    

    the using code:

    
    void SetChipEnableOn (void)
    {
      P2 = 0xFF;
    }
    
    void SetChipEnableOff (void)
    {
     P2 = 0;				
    }
    

    ... and

    
    InitClockLib ( (u_char*) &SetChipEnableOn, (u_char*) &SetChipEnableOff);
    
    

    In the Overlay ... I have to write

    Read ! (SetChipEnableOn, SetUhrChipEnableOff),
    Write ! (SetChipEnableOn, SetUhrChipEnableOff)
    
    

    Thank for your Help

    Norbert

Children
No data