c++ - Serializing a Pointer using MFC CArchive (with mfc100d.dll, CMemFile) -


I am running an issue in serializing and deserializing pointer data in VS2010 VC ++.

2) We add DECLARE_SERIAL (MyObject) to class declaration (1 line);

1) MyObject was inherited from CObject; ;

3) We have added IMPLEMENT_SERIAL (MyObject, MyParentObject, SCHEMA_VERSION)

  // Where the MIFARI object is inherited from CObject (indirectly, some of the objects And level), SCHEMA_VERSION is the only control of one version that we use   

4) Then we are overloaded

  zero MyObject :: Serialize ( Carchive & amp; ar) {BOOL B; ..... ... (some other simple variables with default values) MyParentObject :: Serialize (AR); If (ar.IsStoring ()) {ar ​​& lt; & Lt; M_sTitle; R & lt; & Lt; M_pObjectsList; } And {AR> & Gt; M_sTitle; AR & gt; & Gt; M_pObjectsList; }}   

Note: MyParentObject :: Serialize has been implemented accordingly. Kobilist * M_PP object list; Header file has been declared correctly.

This program deserialize when the first violation of the entry to 0x52e77b2c (mfc100d.dll) in MyApp.exe (0xC0000005: Access violation space 0x00000004 attempted to access), "Ar> gt; ; M_pObjectsList "from

Then I started the trial and changed the complex pointer m_pObjectsList to a simple pointer for CSTIR. The same error occurs at the same time, when the indicator is deciphering the CSTIR. If I only serialize and deserialize by CSTIR (without the pointer), it works fine. It seems that some pointer serial has been broken.

Perhaps the MFC100d does not work well with the W32 program in a 64-bit OS debugger? This is causing problems in both debug mode and release mode. What is happening? I have ended my resources and appreciated any direction or inspiration. Thank you all to the front.

indicator can not be serialized .

There is no guarantee that

  1. the application will have access to the area of ​​memory near the reader
  2. The data will be inserted into the OS
  3. Reading the file will be placed in the same place in memory

    The same thing is to emulate the indicator using file offset thus An object is located at the beginning of the file at the beginning. It is hard.

    Write and read data of all of data It is a good idea to place data in memory It also gives the application freedom to use the data structure you want to store. is.

Comments