开发者

Getting a FileNotFoundException on lua51.dll when using LuaInterface on C# 4.0 but it's right there

开发者 https://www.devze.com 2023-04-11 15:44 出处:网络
I\'ve been using LuaInterface and Lua 5.1 in several C# applications that required scripting, most notably a few games, an IRC bot and a full IRC client that I\'ve recently decided to resume working o

I've been using LuaInterface and Lua 5.1 in several C# applications that required scripting, most notably a few games, an IRC bot and a full IRC client that I've recently decided to resume working on.

At one point, I switched to .Net 4.0 and had to recompile LuaInterface and Lua51 just to get them to run again. As far as I could tell, all was good.

However, I recently bought a new laptop and tried to run my bot from it. To my surprise it broke when it tried to initialize Lua, citing a FileNotFoundException on lua51.dll, which was sitting right there. I shrugged it off for later and continued reinstalling things, including Visual C# and C++ 2010 Express, and some updates. The next morning I tried starting the chatbot again to try and figure it out -- lo and behold, it worked. For some strange reason.

Earlier today, a friend of mine told me to finish the IRC client I was working on, which makes rather extensive use of 开发者_如何转开发Lua to add functions and other cool stuff. I gave said friend a copy to check out for the most important problems... and he got the exact same error.

Now, the other guy does not have Visual Studio, I can't reproduce the problem, and one can't expect users of the other things I listed above to install it just to get them running -- the average relatively sane user would just shrug and get rid of the program.

So what do, SO?


citing a FileNotFoundException on lua51.dll, which was sitting right there

Which makes it likely that it complained about not finding a DLL that lua51.dll needs. A very likely one is msvcr100.dll, the C/C++ runtime support library. Which does get installed when you install Visual Studio. You can rebuild lua with the /MT option so the CRT is included in the DLL itself. Or tell your friend to download and install this.


You can try SysInternals' Process Monitor. I often use this to figure out the root cause of these sorts of problems. It will show you low-level details of where on the file system the application is looking for the dll which should give you an indication of why it's not being found.

You will probably need to play with the search and filtering options because it generates a lot of data, but it's the best tool I've found for troubleshooting issues like this.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号