is your aim something like an intelligent program editor where-in you write a program and execute the 'compile' option in the editor. Here the editor picks up the source program and passes it on to the compiler for compilation. The extra functionality you need is that some of the variables that are explicitly specified should be allocated in contiguous/successive memory locations? Is it?
Well, I am not aware of any such options for gcc atleast, but I feel that such things are to be taken care in the source program itself. Encapsulate them in a structure, as suggested earlier.
Still I wonder why you would want them on a same memory page? Is it purely for speed optimization?
Regards, Harsha.
Vinay wrote:
Hello all,
Thank you very much for all your replies. But the project requirements are different. The problem is as follows.
A main program shall be running. An user source
program is given as input to the main program. Along
with the source program, some variables present in the
source program shall also be specified. From the main
program, I need to inform the compiler to allocate
successive memory locations for these variables so
that they reside on the same memory page.
The main program is not allowed to change the type of the variables.
Please give suggestions.
Thanks,
Vinay
--- energon <energon0@xxxxxxxxx> wrote:
Well, you can define a struct with the necessary variable types and allocate some shared memory and map the struct into the shared memory.
Typically, shared memory is allocated in size of page size chunks. So, if your data set size does not span the memory page size, you'll have your data in one page.
Do you need to avoid your data from being paged out of the RAM?
===== -energon0
_______________________________ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com
________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony
--
*****************************
* Sriharsha Vedurmudi
* Software Engineer
* * Redpine Signals Inc.
* Gate #395, Plot 87,88
* Sagar Society, Road #2, * Banjara Hills,
* Hyderabad - 500 034
* www.redpinesignals.com
*
* +91-40-23559911 (Office)
* +91-9849133133 (Mobile)
*****************************