Lua and. NET intermodulation cannot load DLL "Luanet.dll": The specified module could not be found. (Exception from hresult:0x8007007e)

Source: Internet
Author: User
Tags lua

Lua is a scripting language written in C language, and the LUA interpreter is easy to embed in the host language library. Its lightweight, easy to expand features by the vast number of developers love. Here we can get LuaInterFace.dll files through Luaforwindows or Luainterface. Here we provide luainterface package, convenient for everyone to download click on the Open link. The package not only contains LuaInterface.dll also contains Luanet.dell and Lua51.dll files, very convenient.

"Configuring the Development environment"

We use command win key +r input devenv, enter is open VS, at this time a new project. Add the above three DLL files to the project, as shown in the following figure:

At this point we select the reference right----->>>> Add Reference----->>>> Browse the location of the project to open the engineering directory, select LuaInterface.dll, OK. As shown in the figure:

The reference is complete as shown in the figure:

"Call Lua code in C #"

And be happy in the project. Enter the following code:

OK, let's start the project test. If you are x86 the system gets the results as follows:

If you are a x64 system, you will be surprised to find that the error on the header indicated: "DLL" Luanet.dll could not be loaded: The specified module could not be found. (Exception from hresult:0x8007007e). ”

Unable to find the specified module file, we suspect that the DLL file is missing from the Debug folder. We copied all three files to the directory and ran it again. Found it normal.

"Attention"

1, we repeatedly try to remove any of these three files have tried three failed, indicating that these three DLL files are required files. If a DLL is found in the project compilation that cannot be found ("Lua51.dll"

or ("Luanet.dll"). At this point you need Lua51.dll and Luanet.dll files in the debug build directory.

2, if the Compile Times "luainterface.luaexception:" [string "Chunk"]: 1: ' = ' excrpted near ' "", this time the Lua file encoding format to the UTF-8 format is good

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.