将C ++应用程序从32位转换为64位 [英] Converting C++ application from 32 bit to 64 bit

查看:509
本文介绍了将C ++应用程序从32位转换为64位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!我正在寻找一些帮助转换为64位的C ++应用程序中的运行时错误。它在32位工作了近十年。我使用Visual Studio 2010 64位编译器编译它。没有编译器错误。该项目编译成一个dll文件,该文件由也以64位编译的可执行(.exe)应用程序使用。



我遇到的第一个问题是将参数传递给Oracle PL / SQL过程。在调试问题后,我了解到我传递给Oracle的值最后有一个空字符。我在C ++中使用CString变量,我将其传递给PL / SQL过程。我暂时删除了SQL代码中的空字符,但我知道这也不是一个长期的解决方案。有没有其他人在将C ++应用程序从32位转换为64位时遇到此问题?



我的第二个问题与运行时错误有关。从数据库表中读取一行后,应用程序崩溃了。错误是App.exe中0x5c95176e(mfc100d.dll)处的未处理异常:0xC0000005:访问违规读取位置0Xfffffffffffffff8。抛出错误的代码实际上不是我的代码。它是活动模板库中的代码。文件名是atlsimpstr.h。它试图在返回while循环开始之前释放一个字符串。下面代码中的断言失败:

void Release()throw()

{

ATLASSERT(nRefs!= 0);



if(_AtlInterlockedDecrement(& nRefs)< = 0)

{

pStringMgr-> Free(这个);

}

}

我很感激此时的任何建议。谢谢。

Hello! I am looking for some help with run-time errors in C++ application converted to 64-bit. It worked fine in 32-bit for almost a decade. I compiled it using Visual Studio 2010 64-bit compiler. There are no compiler errors. The project compiles into a dll file, which is used by an executable (.exe) application also compiled in 64-bit.

The first problem I encountered was passing a parameter to Oracle PL/SQL procedure. After debugging the problem I learned that the value I am passing to Oracle has a null character at the end. I am using a CString variable in C++, which I am passing to the PL/SQL procedure. I removed the null character within the SQL code for now, but I understand that this is nor a long-term solution. Did anyone else experience this problem converting a C++ application from 32 to 64 bit?

My second problem has to do with a run-time error. The application crashes after I read a row from a database table. The error is "Unhandled exception at 0x5c95176e (mfc100d.dll) in App.exe: 0xC0000005: Acces violation reading location 0Xfffffffffffffff8." The code that throws the error is actually not my code. It is code in the active template library. The file name is atlsimpstr.h. It is trying to release a string before coming back to the beginning of the while loop. The assert in the code below fails:
void Release() throw()
{
ATLASSERT( nRefs != 0 );

if( _AtlInterlockedDecrement( &nRefs ) <= 0 )
{
pStringMgr->Free( this );
}
}
I would appreciate any suggestions at this point. Thanks.

推荐答案

第二个问题是通过在函数开头将两个字符串声明为全局变量来解决的。出于某些奇怪的原因,我只能在调试模式下启动应用程序而不是发布可执行文件。
The second problem was resolved by declaring the two strings as global variables at the beginning of the function. For some strange reason, I can only start the app in Debug mode and not the Release executable.


这篇关于将C ++应用程序从32位转换为64位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆