# Where should an ISR be declared in a library?

Suppose I have a library consisting of TWI.h and TWI.c which contains an ISR defined according to AVR-GCC syntax. For example:

ISR(TWI_vect)
{
switch(TWCR)
{
...
}
}


Should the ISR code go into TWI.h or TWI.c? Or should I put the full ISR in TWI.c and put some sort of ISR "prototype" in TWI.h?

• Generally, any executable or memory consuming code should go into the *.c files. There are cases it is not like that, but they should be well justified. – Eugene Sh. Mar 3 '17 at 18:56

The ISR belongs in the .c file. It's a function that directly generates code that's linked into the executable (that is, it isn't an inline-only function), so that's where it goes.