C/C' memory map & ....
Expert: Narendra - 11/20/2005
Question-------------------------
Followup To
Question -
1>What is C's memory map ?
2>Can u give me a detail idea about interrupt vector table in C?
3>How the processes follow one after another from writing a .C file till the formation of .exe file?
4>Are printf() & scanf() predefined macros ?
TurboC++ 3.0
Answer -
First of all I don't use Turbo C.
And your question is not related to C. The answers change from platform to platform.
1. There is nothing called "memory map" in C. Are you asking about mmap() function?
2. Interrupt Vector table is part of a specific processor/OS. So, C has nothing to do with that. And this table will be in memory and if you know the correct address and how it is layed out, then you can write program to access/modify it.
3. You are asking the compilation steps. This is very straight forward and you can find the answer in any compiler books.
There will be two scans. First it will take care of all the proprocessor directives and replace them by correct values.
Next step is tokenising the whole code and looking for syntax errors.
Then it will create a pseudo code and create symbol table.
So, at this stage you may get .o file called object file.
Next step is linking (which is not actually part of compilation) and all the unknown and non-local identifiers/definitions found during previous step will be searched in the linked objects.
If all the definitions are found, an executable will be created (In windows it will be .exe and in solaris/linux it will be a.out)
And remember, this question is also not related to C.
4. No. they are functions which are part of libc.so.
Regards,
Narendr
Sir,
You said that there is nothing called C's memory map but I found the topic in "The complete reference C" by Herbert Schield. Can u help me to understand the memory layout for any processor/OS so that I can use software interrupt to handle the hardware. Can u send me some links from where I can learn about handling hardwares through C.
Thank You,
Tirthankar
AnswerAs I told you before, the question you are asking is not directly related to see.
"memory layout for any processor/OS?".
There is no generic answer for this.
This you have to study keeping in mind a specific OS or processor.
"handling hardwares through C".
Again there is no generic answer for this. And this is not part of C. The hardware vendor has to provide you the related drivers (software) and using that you will have to know the API's. Or you can read the datasheets of this hardware and write your own drivers.
If you want to know more about this, you can read the book: "Linux Device Drivers". You can download this book at: ftp://ftp.oreilly.com/pub/examples/linux/drivers2/book_pdf.rar
http://www.xml.com/ldd/chapter/book/pdf/ldd_book_pdf.zip
Regards,
Narendra