Subj : Re: Question To : comp.programming From : Dave Date : Wed Sep 28 2005 10:36 am Bill Cunningham wrote: > Is the loader that loads the file into > memory... Part of the operating system, so without specifying which operating system you're using, these questions are impossible to answer. > What part of the file does the loader load first? The entry point? I think Windows reads the entire executable file into memory, then attempts to load any dependent DLLs, before it starts to execute it. > And what address in memory is the file loaded into? In virtual memory, it'll be the same location each time in Windows, because each executable is loaded into its own address space with 4GB address space to play with. > In virtual or physical address? Physical address could change from load to load and could even change over time as memory contents are swapped in and out. This generally isn't important, because the application's virtual address space remains constant, and the virtual memory manager maps virtual to physical addresses keeping track of where a chunk of memory is and what translation to perform on address lookups. > How can I look at the value at 0x000c0 ? int *x=0x00c0; printf("Value at address 0x00c0 is %d\n", *x); This generally isn't useful though; if you mean physical RAM, and some memory mapped hardware is at 0x00c0, then the OS could well map that location in VM to the same location in physical RAM, but usually some kind of OS calls are used to acquire hardware resources. For a meaningful answer you'll need to say what hardware you're using, what OS and what you expect to find at 0x00c0. On a Commodore 64 using the standard BASIC and KERNEL ROMs for example, that would be CAS1, the tape motor interlock. Dave. .