0

Can someone explain me how to store global structures in ram in contiguous memory locations?

I tried the below but it doesnt work..!

pragma section("ramsec",read,write)

pragma section("ramsec1",read,write)

__declspec(allocate("ramsec"))
__declspec(align(8)) 
StructABC_t a;
__declspec(allocate("ramsec"))
__declspec(align(8)) 
StructDA_t b;

i want the above a,b structure to be stored in ram next to each other!!???

Community
  • 1
  • 1
vijay kumar
  • 81
  • 1
  • 3
  • If you want a contiguous block of memory, you have to allocate it whole with a single call to operator new[] or malloc() or similar. Multiple calls to these functions do not guarantee any contiguity of allocated blocks whatsoever. You may allocate a big block and then carve parts from it as needed. – Santosh Dhanawade May 30 '13 at 08:12
  • but when you are doing a embedded project, you have linker description file,which can be used for this kind of purpose. Does VC++ also offer something similar.. – vijay kumar May 30 '13 at 08:57
  • are you talking about hardware kind of thing?? – Santosh Dhanawade May 30 '13 at 09:11
  • actually i trying to simulate hardware code behavior in VC++ environment.. – vijay kumar May 30 '13 at 09:16
  • then better use http://msdn.microsoft.com/en-us/library/windows/hardware/ff554460(v=vs.85).aspx function. – Santosh Dhanawade May 30 '13 at 09:18
  • Hi I tried as explained in the below link, except for they were trying for functions, i am trying for global structures..still doesnt work any ideashttp://stackoverflow.com/questions/3192871/how-to-refer-to-the-start-of-a-user-defined-segment-in-a-visual-studio-project/16837206#16837206 – vijay kumar May 31 '13 at 06:20

0 Answers0