我可以成功编译,但是当我去运行我的程序时,它会引发一个错误,告诉我一个DLL不存在。经过反复试验,我确定该程序正在寻找“ROGRAM FILES \ FolderName \ rrpd.dll”中的DLL,显然会切断文件夹的前四个字符。赋值语句删除字符
这是一个名为R & R Report Writer的应用程序,它已经存在了25年以上,从未遇到过这个问题。
调试,我确定错误来自于程序模块EXPLMGR.CPP赋值语句(显式库管理器):
CString CExplicitLibraryManager::FindLocalDllFile(CString csDllName) const
{
ASSERT(csDllName.Find('\\') == -1); // These names should not have directory stuff.
// Search for the file in the program directory directory.
// If not found there, search in the registry system.
// If not found in either location, just return the file name.
CString csDllPath = m_csAppDirectory + csDllName ;
BOOL bDllExists = DoesFileExist (csDllPath) ; // Don't bother calling DoesDllExist(). A path is provided.
if (!bDllExists)
{
csDllPath = m_csRrSystemDirectory + csDllName ;
bDllExists = DoesFileExist (csDllPath) ;
if (!bDllExists)
{
// Must call the FindWindowsFile() here so that we can guarentee to return the full pathname.
csDllPath = FindWindowsFile (csDllName) ;
bDllExists = DoesFileExist (csDllPath) ;
}
}
if (bDllExists)
{
CFileStatus fsFile ;
CFile::GetStatus (csDllPath, fsFile) ;
//TRACE("CExplicitLibraryManager::FindLocalDllFile() Reports the DLL to be %s\n", fsFile.m_szFullName) ;
csDllPath = fsFile.m_szFullName ;
}
return csDllPath ;
}
具体而言,4号线向上从底部:
csDllPath = fsFile.m_szFullName ;
此时,fsFile.m_szFullName是“C:\ PROGRAM FILES \ FolderName \ rrpd.dll”,csDllPath也是一样的。
调试和点击[F11],分配潜水右转入
c:\program files\Microsoft visual studio\vc98\mfc\src\strcore.cpp
和部分是:
const CString& CString::operator=(LPCTSTR lpsz)
{
ASSERT(lpsz == NULL || AfxIsValidString(lpsz));
AssignCopy(SafeStrlen(lpsz), lpsz);
return *this;
}
立刻,如果我鼠标移到lpsz,它的价值现在是
"rogram files\FolderName\rrpd.dll"
有什么办法可以解决这个问题吗?我可以提供哪些额外信息?
我的第一个想法是重建所有,如果你还没有。 – RichieHindle 2013-05-06 21:42:47
@RichieHindle说什么。这看起来像混合调试和非调试库的结果。 – jdigital 2013-05-06 21:46:42
我已经在release和debug配置中重建了所有的东西。我不确定你的意思是关于调试/非调试库。 – 2013-05-07 11:07:02