Go to
Project Properties->Linker->Advanced.
Set
Entry Point to
mainCRTStartup, or whatever your entry library routine is for your kernel.
Set
Base Address to 1 MB (
0x100000)
All of this may already be set. The following may be new:
Create a new standard text file (Lets call it
Order.txt). Type the function names in order of how you want them to be linked. For example, if mainCRTStartup() is the entry routine, and kmain() is your main() routine, this will work:
You do not need to add any more routines. This will tell MSVC++ to link mainCRTStartup() at the base address (1MB), followed by kmain(). All other code and data will be placed to locations above kmain(), so you never need to edit this file unless you want to.
Now, back in MSVC++ Linker Optimization section...
Under
Function Order, type in the location of your file (For example,
Order.txt)
This should resolve that problem, and insure mainCRTStartup() is always at the base address of 1 MB.