Hi,

thanks, this weird "extern" statement did the trick. I did not know this syntax.

But that's strange:

For a SIGHANDLER that is defined in the SAME file, I have to forward declare it using: SIGHANDLER(portb_isr); ; extern portb_isr fails with:
main.c:162: error 98: conflict with previous definition of 'portb_isr' for attribute 'type'
from type 'int fixed'
to type 'void function    ( )  fixed'

for a SIGHANDLER that is defined in ANOTHER file, I have to extern declare it using : extern i2c_slave_isr; extern SIGHANDLER(i2c_slave_isr); fails with:
main.asm:247:Error [113] Symbol not previously defined (_i2c_slave_isr).
main.asm:247:Error [113] Symbol not previously defined (_i2c_slave_isr).

The errors are different!
And the messages are even formatted differently :-)

Regards
Sebastien

On Tue, Jul 20, 2010 at 9:36 AM, Roel Adriaans <roel@adriaans.org> wrote:
  Op 19-7-2010 17:10, Sébastien Lorquet wrote:
> hi,
>
> i'm playing with interrupts in pic18.
>
The way I use this works. Code is for the uart interrupts:

main.c:

extern _RC_handler;
extern _TX_handler;

DEF_INTHIGH(high_int)
DEF_HANDLER(SIG_RC, _RC_handler)
DEF_HANDLER(SIG_TX, _TX_handler)
END_DEF

And in an uart.c:
SIGHANDLER(_TX_handler) {
    // Code
}

SIGHANDLER(_RC_handler) {
    // Code here
}

And the resulting code in main.asm:
    btfsc _PIR1, 5
    goto __RC_handler
    btfsc _PIR1, 4
    goto __TX_handler

And the linker does the rest of the magic.

Hope this helps you further,

Roel Adriaans

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user