Function override.

I have made my own task switcher, it’s a non preemptive task switcher. I normally replace function call to Arduino's delay with my own function. But it would be easier if I could override the Arduino’s delay function with my own. I have tried defined a function:

void delay(unsigned long t) { }

If I compile it I get the error: multiple definition of `delay'

But are there a way to override a function in Arduino?

Change the function in wiring.c

void delay(unsigned long ms)
  uint16_t start = (uint16_t)micros();

  while (ms > 0) {
    if (((uint16_t)micros() - start) >= 1000) {
      start += 1000;

Or try a #define:
#define delay(s) mydelay(s)

That happens long before linking which is where you are getting those multiply defined errors.

Changing the delay() function in wiring.c will make the Arduino installation non standard and will need doing again when the IDE is upgraded. Creating a new "delay" function in a library would seem to be a better alternative as it is easy to copy to other PCs and will still work after an IDE upgrade.

As a matter of interest what do you want the new version of delay() to do ?

Whandall: Change the function in wiring.c

Or just make it weak:

__attribute__ ((weak))
void delay(unsigned long ms)

This way you can write your own version which overrides the default one.

ETA: Clarification: make the original weak, not your own version.