正在重置全局变量,在Windows 7上可以看到问题 [英] Global variables are being reset, problem seen on windows 7

查看:77
本文介绍了正在重置全局变量,在Windows 7上可以看到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在重置全局变量,在Windows 7上看到问题

Global variables are being reset, problem seen on windows 7

 

我们有一个应用程序,它有一个客户端服务器模型,我在Windows上的客户端工作,它基本上是一个MFC应用程序。

We have an appplication which has a client server model and I work on the client side on windows and it is basically a MFC application.

我有一个小问题一段代码在Windows XP上运行良好,但在Windows 7中运行不正确(这是客户报告但应用程序正在我的Windows 7专业64位操作系统上运行,所以这是
的特定问题我无法破解的客户环境)

I am having a problem with a small piece of code which works well on windows XP , but not in Windows 7 (that is what the customer reports but the application is working on my windows 7 professional 64 bit OS too , so this is kind of a specific problem with the customer environment which I am not able to crack)

我遇到问题的流程是 -

The flow where I am having problem is -

我已经定义了一个全局变量(n )在我的代码(a.dll)中的一个模块中,我在类构造函数中为它赋值,这是我想要全局变量保存的值。 然后从类成员函数之一我调用.NET dll(b.dll)
,它再次从我的a.dll调用导出的函数,所以场景是在a.dll中有一个类C1(及其成员函数)和导出的C函数类似于 - extern"C"导出LPCTSTR _stdcall fun1(),在类成员函数
中我调用b.dll,adn b.dll调用fun1(),当我调试fun1时,我看到n是0(它正在重置,这是与我在全局范围内定义的相同)

I have defined a global variable (n) in one of the modules in my code(a.dll) and I assign a value to it in the class constructor, which is the value I want the global variable to hold.  Then from one of the class member function I call a .NET dll(b.dll) , which in turns again calls a exported function from my a.dll , so the scenario is in a.dll there is a class C1(and its member functions) and an exported C function something like - extern "C" EXPORT LPCTSTR _stdcall fun1() , In the class member function I call b.dll , adn b.dll calls fun1() , when I debug fun1 I see that n is 0 (it is getting reset, which is the same as I defined in the global scope)

就像我上面写的那样,问题只发生在Windows 7企业版的客户端盒上,并且不会出现在我的盒子上,这是一个Windows 7专业版操作系统。企业和专业是否重要,我试图复制客户拥有的一些软件
,但它似乎无法帮助我重现这个问题。

Like I wrote above , the problem occurs only on the customer box which is a Windows 7 Enterprise edition and does not occur on my box which is a Windows 7 Professional OS. Does the Enterprise and Professional matter , I tried to copy some of the software which the customer has but it does not seem to help me in reproducing the issue.

有没有人见过这个问题?

Has anyone seen this issue ?

推荐答案

>>当我调试fun1时,我看到n是0(它正在重置,这与我在全局范围内定义的相同)



既然你可以调试,你可以尝试设置一个数据断点吗?你会打破当"n"中的值为"n"时更改。

>>when I debug fun1 I see that n is 0 (it is getting reset, which is the same as I defined in the global scope)

Since you can debug, can you try setting a data breakpoint ? You will break when teh value in "n" changes.

http:// msdn.microsoft.com/en-us/library/350dyxd0(v=VS.85).aspx

-Seetharam

-Seetharam


这篇关于正在重置全局变量,在Windows 7上可以看到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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