[英]When I compile my program for Debugging the Lua runs fine but why I compile it for release I get a c0000005 error
I'm using LUA for a SDL project.我将 LUA 用于 SDL 项目。 I downloaded the precompiled LIB and DLL file from here (http://sourceforge.net/projects/luabinaries/files/5.2/Windows%20Libraries/Dynamic/) (lua-5.2_Win32_dll10_lib.zip) and have incorporated it into my project.我从这里 (http://sourceforge.net/projects/luabinaries/files/5.2/Windows%20Libraries/Dynamic/) (lua-5.2_Win32_dll10_lib.zip) 下载了预编译的 LIB 和 DLL 文件,并将其合并到我的项目中。 When I build a debug build the application runs 100% fine.当我构建调试版本时,应用程序运行 100% 正常。 When I set it to release mode and press the Play button in Visual Studio it also runs fine.当我将它设置为发布模式并按下 Visual Studio 中的播放按钮时,它也运行良好。
BUT if I run the Release file by doubling clicking it in the folder I get the error c0000005 with the lua52.dll.但是,如果我通过在文件夹中双击它来运行 Release 文件,我会收到带有 lua52.dll 的错误 c0000005。
I'm running MicroSoft Visual C++ 2010 Express.我正在运行 MicroSoft Visual C++ 2010 Express。
I went through deleting lines till it started working and the lines that causes the error are.我经历了删除行直到它开始工作并且导致错误的行是。
void aiBrainmanager::run(string holdData){
int errfunc = 0;
int s;
int s = luaL_loadstring(L, holdData.c_str());
if ( s==0 ) {
s = lua_pcall(L, 0, LUA_MULTRET, errfunc);
}
if (errfunc !=0) {
}
if (s !=0) {
aiBrainmanager::target->stopWorking();
}
}
Any idea what setting is wrong or how to fix it.知道什么设置错误或如何修复它。
0xc0000005 is a memory violation. 0xc0000005 是 memory 违规。 The fact that it works in debug, means a number possible things.它在调试中工作的事实意味着许多可能的事情。
Looking at your code I would look at:查看您的代码,我会查看:
Why are you checking for error and then not doing anything?????你为什么要检查错误然后什么都不做?????
if (errfunc !=0) {
// What happens in here??????
}
The lua_pcall function returns 0 in case of success or one of the following error codes (defined in lua.h): lua_pcall function在成功的情况下返回 0 或以下错误代码之一(在 lua.h 中定义):
LUA_ERRRUN: a runtime error. LUA_ERRRUN:运行时错误。
LUA_ERRMEM: memory allocation error. LUA_ERRMEM: memory 分配错误。 For such errors, Lua does not call the error handler function.对于此类错误,Lua 不会调用错误处理程序 function。
LUA_ERRERR: error while running the error handler function LUA_ERRERR:运行错误处理程序时出错 function
I think you'll find you're getting a LUA_ERRMEM我想你会发现你得到了一个LUA_ERRMEM
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.