The first code to run at bootup in the new controller is the _entry() function in ifi_startup.c. _entry() then calls _startup() when power is applied to the PIC it begins running whatever code is located at _entry(). This allows the developer to add some code in _entry() that my only need to be done at powerup. _startup() in this case initializes the stack pointer, sets up RAM and FLASH memory, calls _do_cinit() which initializes the .cinit section. Then main() is called and your custom processing can begin. Look at pages 42 and 43 in the Microchip C18 compiler manual for more details.
Keep in mind that in C anything with a # in front of it like #define or #ifdef is only used at compile time not at runtime.
Please correct me if I am wrong with any of this.
