5

I've got a question about Lua and https. I'm developing some software for a router which supports Lua. The bad thing is that this router doesn't support debugging. So I was looking for an IDE for Lua.

I'm using the Lua Development Tools and LuaForWindows on a Win 7 64-bit OS. Till now everything works like it should. But now I have to call some urls by https. The router itself has a package ssl.lua and you can user this package with the require ("ssl.https") statement. But I want to debug it with the Lua Development Tools. I was searching for Windows compatible packages and have found the "Luasec" project.

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

I have put the ssl.lua and the ssl folder within my lua installation the I have put the ssl.dll in the clibs folder within the lua installation.

For testing I only do a require ("ssl.https") in my Lua file but it crashes. 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've tested it on a Win 7 32 bit pc too and it crashes 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 anybody please help me getting this work?

Community
  • 1
  • 1
ChristianR
  • 133
  • 2
  • 7

2 Answers2

4

I had this same problem on Windows 7 64 bit as well, using Alien to load a Windows DLL.

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

I have a 32-bit version of the DLL that I loaded instead, and that works. See if you too can find a 32 bit version of your library.

As for your problem on 32 bit Windows, that could of course be due to other factors, though if you are using the same 64 bit DLL, I guess that won't work either.

mydoghasworms
  • 18,233
  • 11
  • 61
  • 95
2

I got this problem yesterday and solved it by downloading the source code of Luasec and built it with static library on a 32-bit windows 7 pc. You may try to build your own.

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

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

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