lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Maybe the information in this repo would help?

Those scripts aid in setting up the environment to build Lua for 32/64 bits in both Mingw and Visual Studio (up to VS2015, long time I don't maintain that).

On Tue, Jun 14, 2022 at 12:20 PM <> wrote:

I’ve tried all the options here without success.


From: Thijs Schreijer <>
Sent: 14 June 2022 10:09
To: Lua mailing list <>
Subject: Re: Creating a 32 bit dll for lpeg using Luarocks




I'm using Luarocks (with the compiler from Visual Studio 2022) to install the lpeg module. It appears to work well, except when I require the resultant lpeg.dll I get:


An error has occurred – [snip] error loading module 'lpeg' from file 'C:\Program Files (x86)\XXXX\Lua\lpeg.dll': %1 is not a valid Win32 application.


which suggests to me that it has been linked as a 64-bit dll whereas the environment in which it is running must be 32-bit.


I can find various instructions on how to configure VS to produce 32-bit dlls by altering project settings, but nothing on how to make Luarocks do the same. MinGW isn't an option


How do I force Luarocks and Visual Studio 2022 to create a 32-bit dll? I can use Visual Studio 2017 or 2019 if that would provide a solution.


From ancient memory; there was a batch file that would set up things “ vcvarsall.bat” or similar. One could use that to instruct the shell to set up targets; 64/32, debug/non-debug etc.