Is there any way to compile a file so that it will work on a flash cart / emulator and also MultiBoot?
Yes. Use the ReservedStuff header, above, (after the normal ROM header) and compile the rom with the Text section set to 0x2000000. After the ReservedStuff header put some assembly language code in that file that detects if the program is running in ROM or RAM (by looking at the Program counter value.) If the program is running in ROM then copy 256k bytes of the program to external RAM and then branch to 0x2000000. If the program is running in RAM then continue as normal. You should probably give the file an extension of .mb.gba (i.e. myfile.mb.gba) since it works on multiple setups.