We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi
I would like to write a function in C language with the start address 0x2000. How can I define the address of function? Cant ti be done in C language. Any suggestions?
Thanks for your time.
"I would like to write a function in C language with the start address 0x2000."
If you explained why you want to do this, it might help people to give appropriate answers.
"Can it be done in C language"
Strictly, it's not a job for the 'C' language, although some implementations do provide facilities to do this as an extension to the language - check your compiler Manual for details.
It's properly a job for the Locator (nowadays, commonly part of the Linker)...
You normally don't place a C function at a fixed address. You normally place it in a segment, and let the linker place the segment at a fixed address.
But as Andy notes, it is more or less impossible to help people if the original question doesn't explicitly says why a specific request is made, or give enough facts to allow us to deduce why you are making the question.
A large percent of the questions can have an answer - but that answer would be wrong, since the original question was wrong to begin with. A very, very large part of questions about absolute addresses falls within this category. So always mention if you are talking about the entry point for a bootloader-retrieved application, a monitor-accessible entry point or whatever you are trying to implement.