Lua for https windows error: "% 1 is not a valid Win32 application"

I have a question about Lua and https. I am developing software for a router that supports Lua. The bad news is that this router does not support debugging. So I was looking for an IDE for Lua.

I use Lua Development Tools and LuaForWindows on a 64-bit Win 7. So far, everything is working as it should. But now I have to name some https urls. The router itself has the ssl.lua package, and you can use this package with the require ("ssl.https") statement require ("ssl.https") . But I want to debug it using the Lua development tools. I searched for packages compatible with Windows and found a Luasec project.

As mentioned in this thread " Lua with the Freebase API "; I downloaded Luasec .

I put the ssl.lua and ssl folder in my lua installation, I put ssl.dll in the clibs folder in the lua setup.

For testing, I only require ("ssl.https") in the Lua file, but it fails. It says:

 C:\Program Files (x86)\Lua\5.1\lua.exe: error loading module 'ssl.core' from file 'C:\Program Files (x86)\Lua\5.1\clibs\ssl.dll': %1 ist keine zulässige Win32-Anwendung. (%1 is no a valid Win32 application) 

I also tested it on a 32-bit Win 7 computer, and it worked with this:

 C:\Program Files\Lua\5.1\lua.exe: error loading module 'ssl.core' from file 'C:\Program Files\Lua\5.1\clibs\ssl.dll': Das angegebene Modul wurde nicht gefunden. (The module cant be found) 

Can someone help me get this job?

+4
source share
2 answers

I had the same problem on a 64-bit version of Windows 7, using Alien to load the Windows DLL.

The library I loaded (i.e. DLL) was a 64-bit DLL, but Lua for Windows is a 32-bit application.

I have a 32-bit version of the DLL that I downloaded and it works. See if you can also find the 32-bit version of your library.

As for your problem with 32-bit Windows, this may be related, of course, to other factors, although if you use the same 64-bit DLL, I think that will not work either.

+3
source

I had this problem yesterday, and I decided to download it by downloading the Luasec source code and building it with a static library on 32-bit windows 7 pcs. You can try to build your own.

I changed some configurations in my C / C ++ and Linker project properties. Below I have changed:

  • C / C ++ → Code Generation → Runtime Library: Multithreaded (/ MT)
  • Linker → General → Additional Library Directories: C: \ OpenSSL-Win32 \ lib \ VC \ static
  • Linker -> Input -> Additional Dependencies: add libeay32MT.lib and ssleay32MT.lib

Or if you need, you can download my version here .

+1
source

Source: https://habr.com/ru/post/1491795/