How To: User Defined TIMER0_OVF_vect

Hi,
I am working on a POV (Persistence of Vision) project that looks like it is going to need all three timers for various timing considerations. I have successfully compiled it in Atmel Studio 6 and run it on a breadboarded ATMEGA328P using no Arduino core or contributed libraries.

Now I would like to add the ability to read an IR remote. The easiest way to do this would be to use the IRemote library by Ken Shirriff (A Multi-Protocol Infrared Remote Library for the Arduino). Since his code is designed for the Arduino, he uses the core Arduino libraries.

I have figured out how to combine the Arduino core libraries, IRemote, and my code and compile it all together in Studio 6. This almost gets me all the way there...

Here's the problem:
The core Arduino libraries already define the Timer0 Overflow ISR. I need to define that ISR for my own use. When I compile, I get errors indicating the the ISR is being defined twice.

The question:
Is there some convenient way of telling the Arduino libraries to not define the Timer0 Overflow ISR? I know I can start hacking away at my own local Arduino library and probably make it work, but I would like to keep the Arduino library completely as-is if possible. That way I can use other Arduino functions and contributed libs without having to change the Arduino libraries back.

Any suggestions would be greatly appreciated.

Why do you include wiring.c if you don't need it? Sure, without it you cannot use delay(), millis() or micros() but for all these you need the timer and the appropriate interrupt handler too.

Thanks for the response [pylon],

As far as I can tell, when I include Arduino.h to get the various pin mappings needed in the IRemote contributed library, wiring.c is a dependency, so the compiler includes it in the link.

What I want to do, is include Arduino.h, but "somehow" tell wiring.c not to include the Timer0 Overflow ISR definition. Ideally there would be a preprocessor #define I could use. Something like:
#define DONT_DEFINE_ISRS.

In searching the forum, I did see some reference to using:
ISR(TIMER0_OVF_vect) __attribute__ ((weak)) in the Arduino library ISR definitions. Apparently this would allow the user to later override the ISR definitions. I tried it, but my user ISR appears to be getting defined before the Arduino ISR, so that didn't help. I will investigate further.

Just define these routines in your code and you won't have problems without including wiring.c:

unsigned long millis(void);
unsigned long micros(void);
void delay(unsigned long);
void delayMicroseconds(unsigned int us);

Start your sketch with this...

void myinit()
{
}

int main( void )
{
  myinit();
  setup();
  while ( true ) { loop(); }
}

As needed, copy code from init into myinit to initialize hardware.

Thanks for the responses [pylon] and [Coding Badly].

[pylon], that was exactly what I was looking for! Thanks! Defining those empty functions in my code kept the compiler from linking the Arduino code, allowing me to write my own TIMER0_OVF_vect ISR.

This is a very useful technique when writing code that will be compatible with Arduino libraries. You just have to remember that you have disabled the delay functions.

In fact in the IRemote library which I am using, both delay() and delayMicroseconds() are used. These functions are only used when transmitting IR codes, which I won't be doing, so I should be good to go.

Thanks again.