Binary data-structure serialization

Robert robert.muench at robertmuench.de
Thu Jun 3 11:02:28 PDT 2010


On 2010-06-03 15:45:11 +0200, Andrei Alexandrescu 
<SeeWebsiteForEmail at erdani.org> said:

> Once created, a file mapping is at a constant address.

Hi, sorry but don't get this. This is true for one session. But the 
next time you run the prog the mapping can be on an other address.

> If you remap a file (an unsafe operation),

What do you mean by "remaping a file"?

>  you can memcpy the data around. All D objects are assumed to be relocatable.

Still don't get it.

If a MMF is mapped into VM at 0x1000 and you create objects and 
pointers, the pointers within the MMF need to get 0x1000 substracted. 
Only in this case the pointer within the MMF references an address = 
the index within the file.

-- 
Robert M. Münch
http://www.robertmuench.de



More information about the Digitalmars-d mailing list