本文介绍了多线程DLL(/ MD)运行时的序列化错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

       在Visual Studio 2015中,我正在进行对象序列化并成功写入二进制文件* .lim。

       In visual studio 2015, I am doing object serialization and writing in binary file *.lim successfully.

  &NBSP; &NBSP;  从二进制文件a读取时加载存档。它在   多线程调试DLL(/ MDd)中正常工作。如果将运行时更改为多线程DLL(/ MD) 得到一个错误"意外的对象在< g class =" gr_
gr_25 gr-alert gr_gramm gr_inline_cards gr_run_anim grammar only-ins doubleReplace replaceWithoutSep"数据-GR-ID =" 25" id =" 25"> file< / g>

       When reading from binary file a to load archive.Its working fine in  Multi-threaded Debug DLL (/MDd). If change runtime to Multi-threaded DLL (/MD)  getting an error "unexpected object find in <g class="gr_ gr_25 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="25" id="25">file</g>

  &NBSP; &NBSP;  但是能够使用多线程调试DLL(/ MDd)加载相同的文件,请帮助我,我在这里打了几个星期。

       But able to load the same file with Multi-threaded Debug DLL (/MDd), please help me in this I struck here for a couple of weeks.

/ /选择文件的功能。




//序列化和加载

ASSERT_VALID(this);



CObject :: Serialize(ar);
$


if(ar.IsStoring())

{

ar.WriteCount(m_nCount);

for(CNode * pNode = m_pNodeHead; pNode!= NULL; pNode = pNode-> pNext)

{

ASSERT(AfxIsValidAddress(pNode,sizeof(CNode)));

ar<< pNode->数据;

}

}

其他

{

DWORD_PTR nNewCount = ar.ReadCount();



// CString
m_StandTypeStr;

while(nNewCount--)

{

// ar>> m_StandTypeStr;

ar>> (CObject *&)newObj;

AddTail(newObj);

}

}

ASSERT_VALID(this);

CObject::Serialize(ar);

if (ar.IsStoring())
{
ar.WriteCount(m_nCount);
for (CNode* pNode = m_pNodeHead; pNode != NULL; pNode = pNode->pNext)
{
ASSERT(AfxIsValidAddress(pNode, sizeof(CNode)));
ar << pNode->data;
}
}
else
{
DWORD_PTR nNewCount = ar.ReadCount();

//CString m_StandTypeStr;
while (nNewCount--)
{
//ar >> m_StandTypeStr;
ar >> (CObject *&)newObj;
AddTail(newObj);
}
}

推荐答案


这篇关于多线程DLL(/ MD)运行时的序列化错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 10:05