Looking for Lua Binaries for MSVC 2017

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Looking for Lua Binaries for MSVC 2017

Simon Orde-2

Hi - I have a Visual C++ application that supports Lua plugins using a wide variety of Lua DLLs.  The previous version of the program was written in Visual Studio 2010 and uses Lua 5.1.4.  The Lua DLLs all had to be versions that were built specifically for the 2010 version of the MSVC compiler.  This is because they had to be linked to the C runtime libraries that were specific to MSVC 2010.

 

I have now upgraded to Visual Studio 2017 which means that I need new compatible versions of all my Lua DLLs.  My program is still built 32-bit, so I need 32-bit DLLs.  Can anyone suggest where I can get these please?  I had a look at the LuaBinaries page on SourceForge and elsewhere, but cannot find a suitable source for the DLLs.

 

If possible, I would like DLLs that will not need to be replaced if I upgrade my compiler in the future.   Any advice on this issue would be appreciated too.

 

I presume that I will need to upgrade to Lua 5.3.5?

 

The core Lua DLLs that I need are:

 

                CD (16 dlls)

                IM (16 dlls)

                IUP (29 dlls)

                LUA5.1.dll (or its equivalent for Lua 5.3.5)

                LUACOM.DLL

                LUAGL.DLL

                LFS.DLL

 

In addition I also need

 

                LUASQL(4 dlls - Kepler project)

                MD5 (2 dlls - Kepler project)

                SOCKET (2 dlls - LuaRocks)

                ZIP.DLL (LuaRocks)

 

All help very much appreciated.

 

Simon

Reply | Threaded
Open this post in threaded view
|

Re: Looking for Lua Binaries for MSVC 2017

Thijs Schreijer
You could use LuaWinMulti to create a local working Lua install, incl. LuaRocks, and use that to install and generate the libs.

Just use it from the VS command shell and it should be using the proper toolchain.



On 20 Mar 2019, at 16:57, Simon Orde <[hidden email]> wrote:

Hi - I have a Visual C++ application that supports Lua plugins using a wide variety of Lua DLLs.  The previous version of the program was written in Visual Studio 2010 and uses Lua 5.1.4.  The Lua DLLs all had to be versions that were built specifically for the 2010 version of the MSVC compiler.  This is because they had to be linked to the C runtime libraries that were specific to MSVC 2010.
 
I have now upgraded to Visual Studio 2017 which means that I need new compatible versions of all my Lua DLLs.  My program is still built 32-bit, so I need 32-bit DLLs.  Can anyone suggest where I can get these please?  I had a look at the LuaBinaries page on SourceForge and elsewhere, but cannot find a suitable source for the DLLs.
 
If possible, I would like DLLs that will not need to be replaced if I upgrade my compiler in the future.   Any advice on this issue would be appreciated too.
 
I presume that I will need to upgrade to Lua 5.3.5? 
 
The core Lua DLLs that I need are:
 
                CD (16 dlls)
                IM (16 dlls)
                IUP (29 dlls)
                LUA5.1.dll (or its equivalent for Lua 5.3.5)
                LUACOM.DLL
                LUAGL.DLL
                LFS.DLL
 
In addition I also need
 
                LUASQL(4 dlls - Kepler project)
                MD5 (2 dlls - Kepler project)
                SOCKET (2 dlls - LuaRocks)
                ZIP.DLL (LuaRocks)
 
All help very much appreciated. 
 
Simon

Reply | Threaded
Open this post in threaded view
|

Re: Looking for Lua Binaries for MSVC 2017

Russell Haley
In reply to this post by Simon Orde-2


On Wed, Mar 20, 2019 at 8:57 AM Simon Orde <[hidden email]> wrote:

Hi - I have a Visual C++ application that supports Lua plugins using a wide variety of Lua DLLs.  The previous version of the program was written in Visual Studio 2010 and uses Lua 5.1.4.  The Lua DLLs all had to be versions that were built specifically for the 2010 version of the MSVC compiler.  This is because they had to be linked to the C runtime libraries that were specific to MSVC 2010.

 

I have now upgraded to Visual Studio 2017 which means that I need new compatible versions of all my Lua DLLs.  My program is still built 32-bit, so I need 32-bit DLLs.  Can anyone suggest where I can get these please?  I had a look at the LuaBinaries page on SourceForge and elsewhere, but cannot find a suitable source for the DLLs.

 

If possible, I would like DLLs that will not need to be replaced if I upgrade my compiler in the future.   Any advice on this issue would be appreciated too.

 

I presume that I will need to upgrade to Lua 5.3.5?

 

The core Lua DLLs that I need are:

 

                CD (16 dlls)

                IM (16 dlls)

                IUP (29 dlls)

                LUA5.1.dll (or its equivalent for Lua 5.3.5)

                LUACOM.DLL

                LUAGL.DLL

                LFS.DLL

 

In addition I also need

 

                LUASQL(4 dlls - Kepler project)

                MD5 (2 dlls - Kepler project)

                SOCKET (2 dlls - LuaRocks)

                ZIP.DLL (LuaRocks)

 

All help very much appreciated.

 

Simon

Heads up that IUP might be a problem because it's built with mingw (GCC) not msvc. Antonio Scuri might be able to provide more insight, but there are no VS build instructions for IUP. He does provide binaries of IUP and Lua that are pre-configured to work together (available on source forge). There are also Lua mingw binaries provided by JoeDF (https://joedf.ahkscript.org/LuaBuilds/) and he has a link to the runtime dll. That may get you over the "needs to be MSVC" hump? The runtime link is in the text below the download links on his page.

For MSVC solutions:
LuaWinMake and LuaWinMulti are excellent choices: very simple and flexible. 

I've also got a Visual Studio 2017 project file with Wix Installer modules here (You'll want to use the project in the Visual Studio folder, not the Release2 folder.): 

 Note that the Visual Studio project is quite brittle - you can't just move the source code around without having to remove and re-add the source files (or modify the project files manually) and building for multiple versions requires multiple projects. The VC projects are good if you want to use the MS debugger.

A third alternative is to scavenge from the KeraLua project: it has a CMake based lua build.  KeraLua is part of the NLua project that brings Lua to Microsoft.Net. I've been using it to create a Lua enabled serial console: https://github.com/RussellHaley/NLuaSerialConsole

I'll also point out that if you're integrating with C++, Sol2 is an excellent C++ interface for Lua. I've used it in some small projects with Qt and VS 2017 (both using the MSVC compiler).

In terms of integrating Lua and C++ or .Net: I've been finding it easier to wrap MS libraries and expose them to Lua, rather than trying to import a bunch of Lua modules. The wrapper methodology becomes quite trivial if you use Sol2 or NLua. Most of my integration projects are still just small proof of concept so take that advice with a grain of salt. 

If you're intent on using LuaRocks, the new "project configuration" has been quite handy as well: the modules are downloaded to a project specific local folder, but that means you need to copy that folder to your bin directory and it's not portable if you build for more than one architecture. 

Hope that helps? 
Russ
Reply | Threaded
Open this post in threaded view
|

Re: Looking for Lua Binaries for MSVC 2017

Russell Haley


On Wed, Mar 20, 2019 at 11:42 AM Russell Haley <[hidden email]> wrote:


On Wed, Mar 20, 2019 at 8:57 AM Simon Orde <[hidden email]> wrote:

Hi - I have a Visual C++ application that supports Lua plugins using a wide variety of Lua DLLs.  The previous version of the program was written in Visual Studio 2010 and uses Lua 5.1.4.  The Lua DLLs all had to be versions that were built specifically for the 2010 version of the MSVC compiler.  This is because they had to be linked to the C runtime libraries that were specific to MSVC 2010.

 

I have now upgraded to Visual Studio 2017 which means that I need new compatible versions of all my Lua DLLs.  My program is still built 32-bit, so I need 32-bit DLLs.  Can anyone suggest where I can get these please?  I had a look at the LuaBinaries page on SourceForge and elsewhere, but cannot find a suitable source for the DLLs.

 

If possible, I would like DLLs that will not need to be replaced if I upgrade my compiler in the future.   Any advice on this issue would be appreciated too.

 

I presume that I will need to upgrade to Lua 5.3.5?

 

The core Lua DLLs that I need are:

 

                CD (16 dlls)

                IM (16 dlls)

                IUP (29 dlls)

                LUA5.1.dll (or its equivalent for Lua 5.3.5)

                LUACOM.DLL

                LUAGL.DLL

                LFS.DLL

 

In addition I also need

 

                LUASQL(4 dlls - Kepler project)

                MD5 (2 dlls - Kepler project)

                SOCKET (2 dlls - LuaRocks)

                ZIP.DLL (LuaRocks)

 

All help very much appreciated.

 

Simon

Heads up that IUP might be a problem because it's built with mingw (GCC) not msvc. Antonio Scuri might be able to provide more insight, but there are no VS build instructions for IUP. He does provide binaries of IUP and Lua that are pre-configured to work together (available on source forge). There are also Lua mingw binaries provided by JoeDF (https://joedf.ahkscript.org/LuaBuilds/) and he has a link to the runtime dll. That may get you over the "needs to be MSVC" hump? The runtime link is in the text below the download links on his page.
Argh! I'm totally wrong about IUP!  MSVC binaries are right here (I think he has the Lua binaries in there too):


Sorry for the confusion. :(
Russ

For MSVC solutions:
LuaWinMake and LuaWinMulti are excellent choices: very simple and flexible. 

I've also got a Visual Studio 2017 project file with Wix Installer modules here (You'll want to use the project in the Visual Studio folder, not the Release2 folder.): 

 Note that the Visual Studio project is quite brittle - you can't just move the source code around without having to remove and re-add the source files (or modify the project files manually) and building for multiple versions requires multiple projects. The VC projects are good if you want to use the MS debugger.

A third alternative is to scavenge from the KeraLua project: it has a CMake based lua build.  KeraLua is part of the NLua project that brings Lua to Microsoft.Net. I've been using it to create a Lua enabled serial console: https://github.com/RussellHaley/NLuaSerialConsole

I'll also point out that if you're integrating with C++, Sol2 is an excellent C++ interface for Lua. I've used it in some small projects with Qt and VS 2017 (both using the MSVC compiler).

In terms of integrating Lua and C++ or .Net: I've been finding it easier to wrap MS libraries and expose them to Lua, rather than trying to import a bunch of Lua modules. The wrapper methodology becomes quite trivial if you use Sol2 or NLua. Most of my integration projects are still just small proof of concept so take that advice with a grain of salt. 

If you're intent on using LuaRocks, the new "project configuration" has been quite handy as well: the modules are downloaded to a project specific local folder, but that means you need to copy that folder to your bin directory and it's not portable if you build for more than one architecture. 

Hope that helps? 
Russ
Reply | Threaded
Open this post in threaded view
|

Re: Looking for Lua Binaries for MSVC 2017

Antonio Scuri-2
In reply to this post by Simon Orde-2
  Hi Simon,

  The packages you are looking for are named "xxxx_Win32_dll15.zip", at least for LuaGL, IUP, CD, IM and LuaBinaries. They are available even for Lua 5.1. Notice that for each library there are two packages to download, the regular library and the Lua binding.

  The "Tools Executable" package in the IUP downloads contains almost all the DLLs you need. But they were built with Visual C++ 10 (Visual Studio 2010), so they will still work in Windows XP.

  Unless you have a very specific need, that I'm not aware of, the vc10 DLL will work fine in Visual Studio 2017. There are just a few ground rules for that to work, for instance memory allocated in one module should be freed by that module, the same with other handles like FILE*. Since you are using Lua, then this is quite simple.

Best,
Scuri


Em qua, 20 de mar de 2019 às 12:57, Simon Orde <[hidden email]> escreveu:

Hi - I have a Visual C++ application that supports Lua plugins using a wide variety of Lua DLLs.  The previous version of the program was written in Visual Studio 2010 and uses Lua 5.1.4.  The Lua DLLs all had to be versions that were built specifically for the 2010 version of the MSVC compiler.  This is because they had to be linked to the C runtime libraries that were specific to MSVC 2010.

 

I have now upgraded to Visual Studio 2017 which means that I need new compatible versions of all my Lua DLLs.  My program is still built 32-bit, so I need 32-bit DLLs.  Can anyone suggest where I can get these please?  I had a look at the LuaBinaries page on SourceForge and elsewhere, but cannot find a suitable source for the DLLs.

 

If possible, I would like DLLs that will not need to be replaced if I upgrade my compiler in the future.   Any advice on this issue would be appreciated too.

 

I presume that I will need to upgrade to Lua 5.3.5?

 

The core Lua DLLs that I need are:

 

                CD (16 dlls)

                IM (16 dlls)

                IUP (29 dlls)

                LUA5.1.dll (or its equivalent for Lua 5.3.5)

                LUACOM.DLL

                LUAGL.DLL

                LFS.DLL

 

In addition I also need

 

                LUASQL(4 dlls - Kepler project)

                MD5 (2 dlls - Kepler project)

                SOCKET (2 dlls - LuaRocks)

                ZIP.DLL (LuaRocks)

 

All help very much appreciated.

 

Simon

Reply | Threaded
Open this post in threaded view
|

RE: Looking for Lua Binaries for MSVC 2017

Simon Orde-2

Thank you Scuri, Thijs and Russ, for your posts.  They were all helpful and have helped me move forward on this.  I’m not there yet but I’m making progress.  I’ve managed to use LuaRocks to build various modules. 

 

Scuri – can I clarify a couple of things?

 

I have now found a whole bunch of core binaries for Lua (5.3.5), IM (3.13), CD (5.12), IUP (3.26) and LuaGL (1.11) in SourceForge.   It looks to me if the core dll files I need (given that I’m looking for 32-bit Visual Studio 2017 compatible and Lua 5.3.5 compatible binaries) are the dlls in these zip files:

 

·         lua-5.3.5_Win32_dll15_lib.zip

·         im-3.13_Win32_dll15_lib.zip

·         im-3.13-Lua53_Win32_dll15_lib.zip

·         cd-5.12_Win32_dll15_lib.zip

·         cd-5.12-Lua53_Win32_dll15_lib.zip

·         iup-3.26_Win32_dll15_lib.zip

·         iup-3.26-Lua53_Win32_dll15_lib.zip

·         luagl-1.11-Lua53_Win32_dll15_lib.zip

 

Does that look right?  i.e. IM, CD and IUP have an extra set of Lua5.3-related dlls that have to be added in separately; and Lua and Luagl don’t.  Correct?

 

Also, I have a problem: For historical reasons, I use run-time dynamic linking.  To call a function in “lua53.dll”, I call the win32 function ::LoadLibrary, passing it the path to lua53.dll, and then call ::GetProcAddress to get the addresses of all the functions I need to call.  I’ve managed to get that working for lua53.dll (had to make some updates because of changes to the API since 5.1, but so far that seems OK).  But I also need to call a couple of functions in iuplua53.dll (specifically iuplua_open and iuplua_close).  And that is not working. When I call ::LoadLibrary for iuplua53.dll, the call fails (returns NULL).

 

I have copied all of the DLLs from the zip files above, into a single folder – including iuplua53.dll.  I tried running Dependency Walker and Dependencies, to view the dependencies for iuplua53.dll.  The former produces various warnings, but I think they’re all spurious and just there because Dependency Walker was never updated for Windows 10.  ‘Dependencies’ shows no problems with iuplua53.dll in this context.  And yet LoadLibrary fails.  Any thoughts as to what the problem might be?

 

Simon

 

 

 

 

 

 

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Antonio Scuri
Sent: 21 March 2019 8:57 PM
To: Lua mailing list
Subject: Re: Looking for Lua Binaries for MSVC 2017

 

  Hi Simon,

 

  The packages you are looking for are named "xxxx_Win32_dll15.zip", at least for LuaGL, IUP, CD, IM and LuaBinaries. They are available even for Lua 5.1. Notice that for each library there are two packages to download, the regular library and the Lua binding.

 

  The "Tools Executable" package in the IUP downloads contains almost all the DLLs you need. But they were built with Visual C++ 10 (Visual Studio 2010), so they will still work in Windows XP.

 

  Unless you have a very specific need, that I'm not aware of, the vc10 DLL will work fine in Visual Studio 2017. There are just a few ground rules for that to work, for instance memory allocated in one module should be freed by that module, the same with other handles like FILE*. Since you are using Lua, then this is quite simple.

 

Best,

Scuri

 

 

Em qua, 20 de mar de 2019 às 12:57, Simon Orde <[hidden email]> escreveu:

Hi - I have a Visual C++ application that supports Lua plugins using a wide variety of Lua DLLs.  The previous version of the program was written in Visual Studio 2010 and uses Lua 5.1.4.  The Lua DLLs all had to be versions that were built specifically for the 2010 version of the MSVC compiler.  This is because they had to be linked to the C runtime libraries that were specific to MSVC 2010.

 

I have now upgraded to Visual Studio 2017 which means that I need new compatible versions of all my Lua DLLs.  My program is still built 32-bit, so I need 32-bit DLLs.  Can anyone suggest where I can get these please?  I had a look at the LuaBinaries page on SourceForge and elsewhere, but cannot find a suitable source for the DLLs.

 

If possible, I would like DLLs that will not need to be replaced if I upgrade my compiler in the future.   Any advice on this issue would be appreciated too.

 

I presume that I will need to upgrade to Lua 5.3.5?

 

The core Lua DLLs that I need are:

 

                CD (16 dlls)

                IM (16 dlls)

                IUP (29 dlls)

                LUA5.1.dll (or its equivalent for Lua 5.3.5)

                LUACOM.DLL

                LUAGL.DLL

                LFS.DLL

 

In addition I also need

 

                LUASQL(4 dlls - Kepler project)

                MD5 (2 dlls - Kepler project)

                SOCKET (2 dlls - LuaRocks)

                ZIP.DLL (LuaRocks)

 

All help very much appreciated.

 

Simon

Reply | Threaded
Open this post in threaded view
|

Re: Looking for Lua Binaries for MSVC 2017

Antonio Scuri-2
Does that look right?  i.e. IM, CD and IUP have an extra set of Lua5.3-related dlls that have to be added in separately; and Lua and Luagl don’t.  Correct?

  Yes.

But I also need to call a couple of functions in iuplua53.dll (specifically iuplua_open and iuplua_close).  And that is not working. When I call ::LoadLibrary for iuplua53.dll, the call fails (returns NULL).

  Check the return value for GetLastError after the call, it may lead you to what's going on.

Best,
Scuri


Em sex, 22 de mar de 2019 às 15:38, Simon Orde <[hidden email]> escreveu:

Thank you Scuri, Thijs and Russ, for your posts.  They were all helpful and have helped me move forward on this.  I’m not there yet but I’m making progress.  I’ve managed to use LuaRocks to build various modules. 

 

Scuri – can I clarify a couple of things?

 

I have now found a whole bunch of core binaries for Lua (5.3.5), IM (3.13), CD (5.12), IUP (3.26) and LuaGL (1.11) in SourceForge.   It looks to me if the core dll files I need (given that I’m looking for 32-bit Visual Studio 2017 compatible and Lua 5.3.5 compatible binaries) are the dlls in these zip files:

 

·         lua-5.3.5_Win32_dll15_lib.zip

·         im-3.13_Win32_dll15_lib.zip

·         im-3.13-Lua53_Win32_dll15_lib.zip

·         cd-5.12_Win32_dll15_lib.zip

·         cd-5.12-Lua53_Win32_dll15_lib.zip

·         iup-3.26_Win32_dll15_lib.zip

·         iup-3.26-Lua53_Win32_dll15_lib.zip

·         luagl-1.11-Lua53_Win32_dll15_lib.zip

 

Does that look right?  i.e. IM, CD and IUP have an extra set of Lua5.3-related dlls that have to be added in separately; and Lua and Luagl don’t.  Correct?

 

Also, I have a problem: For historical reasons, I use run-time dynamic linking.  To call a function in “lua53.dll”, I call the win32 function ::LoadLibrary, passing it the path to lua53.dll, and then call ::GetProcAddress to get the addresses of all the functions I need to call.  I’ve managed to get that working for lua53.dll (had to make some updates because of changes to the API since 5.1, but so far that seems OK).  But I also need to call a couple of functions in iuplua53.dll (specifically iuplua_open and iuplua_close).  And that is not working. When I call ::LoadLibrary for iuplua53.dll, the call fails (returns NULL).

 

I have copied all of the DLLs from the zip files above, into a single folder – including iuplua53.dll.  I tried running Dependency Walker and Dependencies, to view the dependencies for iuplua53.dll.  The former produces various warnings, but I think they’re all spurious and just there because Dependency Walker was never updated for Windows 10.  ‘Dependencies’ shows no problems with iuplua53.dll in this context.  And yet LoadLibrary fails.  Any thoughts as to what the problem might be?

 

Simon

 

 

 

 

 

 

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Antonio Scuri
Sent: 21 March 2019 8:57 PM
To: Lua mailing list
Subject: Re: Looking for Lua Binaries for MSVC 2017

 

  Hi Simon,

 

  The packages you are looking for are named "xxxx_Win32_dll15.zip", at least for LuaGL, IUP, CD, IM and LuaBinaries. They are available even for Lua 5.1. Notice that for each library there are two packages to download, the regular library and the Lua binding.

 

  The "Tools Executable" package in the IUP downloads contains almost all the DLLs you need. But they were built with Visual C++ 10 (Visual Studio 2010), so they will still work in Windows XP.

 

  Unless you have a very specific need, that I'm not aware of, the vc10 DLL will work fine in Visual Studio 2017. There are just a few ground rules for that to work, for instance memory allocated in one module should be freed by that module, the same with other handles like FILE*. Since you are using Lua, then this is quite simple.

 

Best,

Scuri

 

 

Em qua, 20 de mar de 2019 às 12:57, Simon Orde <[hidden email]> escreveu:

Hi - I have a Visual C++ application that supports Lua plugins using a wide variety of Lua DLLs.  The previous version of the program was written in Visual Studio 2010 and uses Lua 5.1.4.  The Lua DLLs all had to be versions that were built specifically for the 2010 version of the MSVC compiler.  This is because they had to be linked to the C runtime libraries that were specific to MSVC 2010.

 

I have now upgraded to Visual Studio 2017 which means that I need new compatible versions of all my Lua DLLs.  My program is still built 32-bit, so I need 32-bit DLLs.  Can anyone suggest where I can get these please?  I had a look at the LuaBinaries page on SourceForge and elsewhere, but cannot find a suitable source for the DLLs.

 

If possible, I would like DLLs that will not need to be replaced if I upgrade my compiler in the future.   Any advice on this issue would be appreciated too.

 

I presume that I will need to upgrade to Lua 5.3.5?

 

The core Lua DLLs that I need are:

 

                CD (16 dlls)

                IM (16 dlls)

                IUP (29 dlls)

                LUA5.1.dll (or its equivalent for Lua 5.3.5)

                LUACOM.DLL

                LUAGL.DLL

                LFS.DLL

 

In addition I also need

 

                LUASQL(4 dlls - Kepler project)

                MD5 (2 dlls - Kepler project)

                SOCKET (2 dlls - LuaRocks)

                ZIP.DLL (LuaRocks)

 

All help very much appreciated.

 

Simon

Reply | Threaded
Open this post in threaded view
|

RE: Looking for Lua Binaries for MSVC 2017

Simon Orde-2

>>   Check the return value for GetLastError after the call

 

GetLastError returns 127.

 

For interest, the code looks like this:

 

HMODULE hMod = ::LoadLibrary(strIupDLL);

if (!hMod)

     {

     DWORD dwError = ::GetLastError();

     ....

     }

 

dwError gets set to 127.

 

Incidentally, I said there was nothing obviously wrong when I look at IupLua53.dll in Dependencies.  That’s not right.  There are list of Modules in the bottom pane.  I presume this is a list of linked modules from IupLua53.dll.  The first two are iup.dll and lua53.dll and the value shown in the ‘Checksum’ column for both of these is “0x00000000 (incorrect)”.

 

Unless I’m missing something, it seems like I must have either copied the wrong dlls into the folder, or there’s something wrong with the way iuplua53.dll was built.

 

As far as I can see, you only need 3 files to replicate this:

 

·         lua53.dll (from lua-5.3.5_Win32_dll15_lib.zip)

·         iup.dll (from iup-3.26_Win32_dll15_lib.zip)

·         iuplua53.dll (from iup-3.26-Lua53_Win32_dll15_lib.zip)

 

It seems like if you put those 3 dlls into a folder and call LoadLibrary on iuplua53.dll (in a MSVC 2017 environment), it should load.  But it doesn’t.  If you then open iuplua53.dll in the Dependencies application, you should see the ‘incorrect’ checksums.

 

I tried seeing what happens if you try to load lua53.dll and iup.dll.  It turns out that they each load fine.  It’s just iuplua53.dll that doesn’t.

 

Simon

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Antonio Scuri
Sent: 22 March 2019 7:20 PM
To: Lua mailing list
Subject: Re: Looking for Lua Binaries for MSVC 2017

 

Does that look right?  i.e. IM, CD and IUP have an extra set of Lua5.3-related dlls that have to be added in separately; and Lua and Luagl don’t.  Correct?

 

  Yes.

 

> But I also need to call a couple of functions in iuplua53.dll (specifically iuplua_open and iuplua_close).  And that is not working. When I call ::LoadLibrary for iuplua53.dll, the call fails (returns NULL).

 

  Check the return value for GetLastError after the call, it may lead you to what's going on.

 

Best,

Scuri

 

Reply | Threaded
Open this post in threaded view
|

unregister

gemicha


Reply | Threaded
Open this post in threaded view
|

Re: Looking for Lua Binaries for MSVC 2017

Antonio Scuri-2
In reply to this post by Simon Orde-2
  Hi,

  Lua uses LoadLibrary internally too. I put those 3 files in a folder along with he Lua interpreter and run:

Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> require"iuplua"
table: 02D4D108
> iup.Message("Test", "Hi")

  It works.

  I downloaded the 3 packages you mention to check if there is any corrupt file, but they also work.

  The GetLastErroCode 127 is:

ERROR_PROC_NOT_FOUND
127 (0x7F)
The specified procedure could not be found.

  You can try this code:

void iupwinShowLastError(void)
{
  DWORD error = GetLastError();
  if (error)
  {
    LPTSTR lpMsgBuf = NULL;
    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
                  FORMAT_MESSAGE_FROM_SYSTEM|
                  FORMAT_MESSAGE_IGNORE_INSERTS,
                  NULL, error, 0, 
                  (LPTSTR)&lpMsgBuf, /* weird but that's correct */
                  0, NULL);

    if (lpMsgBuf)
    {
      MessageBox(NULL, lpMsgBuf, TEXT("GetLastError:"), MB_OK|MB_ICONERROR);
      LocalFree(lpMsgBuf);
    }
    else
    {
      MessageBox(NULL, TEXT("Unknown Error"), TEXT("GetLastError:"), MB_OK|MB_ICONERROR);
    }
  }
}

Best,
Scuri


Em sex, 22 de mar de 2019 às 19:27, Simon Orde <[hidden email]> escreveu:

>>   Check the return value for GetLastError after the call

 

GetLastError returns 127.

 

For interest, the code looks like this:

 

HMODULE hMod = ::LoadLibrary(strIupDLL);

if (!hMod)

     {

     DWORD dwError = ::GetLastError();

     ....

     }

 

dwError gets set to 127.

 

Incidentally, I said there was nothing obviously wrong when I look at IupLua53.dll in Dependencies.  That’s not right.  There are list of Modules in the bottom pane.  I presume this is a list of linked modules from IupLua53.dll.  The first two are iup.dll and lua53.dll and the value shown in the ‘Checksum’ column for both of these is “0x00000000 (incorrect)”.

 

Unless I’m missing something, it seems like I must have either copied the wrong dlls into the folder, or there’s something wrong with the way iuplua53.dll was built.

 

As far as I can see, you only need 3 files to replicate this:

 

·         lua53.dll (from lua-5.3.5_Win32_dll15_lib.zip)

·         iup.dll (from iup-3.26_Win32_dll15_lib.zip)

·         iuplua53.dll (from iup-3.26-Lua53_Win32_dll15_lib.zip)

 

It seems like if you put those 3 dlls into a folder and call LoadLibrary on iuplua53.dll (in a MSVC 2017 environment), it should load.  But it doesn’t.  If you then open iuplua53.dll in the Dependencies application, you should see the ‘incorrect’ checksums.

 

I tried seeing what happens if you try to load lua53.dll and iup.dll.  It turns out that they each load fine.  It’s just iuplua53.dll that doesn’t.

 

Simon

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Antonio Scuri
Sent: 22 March 2019 7:20 PM
To: Lua mailing list
Subject: Re: Looking for Lua Binaries for MSVC 2017

 

Does that look right?  i.e. IM, CD and IUP have an extra set of Lua5.3-related dlls that have to be added in separately; and Lua and Luagl don’t.  Correct?

 

  Yes.

 

> But I also need to call a couple of functions in iuplua53.dll (specifically iuplua_open and iuplua_close).  And that is not working. When I call ::LoadLibrary for iuplua53.dll, the call fails (returns NULL).

 

  Check the return value for GetLastError after the call, it may lead you to what's going on.

 

Best,

Scuri

 

Reply | Threaded
Open this post in threaded view
|

RE: Looking for Lua Binaries for MSVC 2017

Simon Orde-2

Hi Scuri

 

Very sorry to have wasted your time, but thank you for looking into it for me.  It was a path issue.  I copied all the DLLs into the same folder as the release executable, but then tested it by running a debug executable which was located in a different folder.  Iup.dll and lua53.dll loaded fine – presumably because they had no non-system dependencies.  But iuplua53.dll required iup.dll and lua53.dll, and neither of these was on the PATH; nor were they in the current directory.  So they weren’t found.  And Dependencies didn’t pick it up because it apparently just looks in the same folder as the subject DLL when looking for dependent DLLs.  Which is fine if the subject DLL is loaded by an executable in that folder, but not otherwise.

 

Anyway – my fault.  Apologies once again.

 

Simon

 

Reply | Threaded
Open this post in threaded view
|

Re: Looking for Lua Binaries for MSVC 2017

Dirk Laurie-2
Op Ma. 25 Mrt. 2019 om 13:40 het Simon Orde
<[hidden email]> geskryf:
>
> Very sorry to have wasted your time, but thank you for looking into it for me.  It was a path issue.  I copied all the DLLs into the same folder as the release executable, but then tested it by running a debug executable which was located in a different folder.  Iup.dll and lua53.dll loaded fine – presumably because they had no non-system dependencies.  But iuplua53.dll required iup.dll and lua53.dll, and neither of these was on the PATH; nor were they in the current directory.  So they weren’t found.  And Dependencies didn’t pick it up because it apparently just looks in the same folder as the subject DLL when looking for dependent DLLs.  Which is fine if the subject DLL is loaded by an executable in that folder, but not otherwise.
>
> Anyway – my fault.  Apologies once again.

No need to apologise. This list is the right place for asking help,
even if you end up by finding the answer yourself. All problems look
elementary once the solution is pointed out.

-- Dirk

Reply | Threaded
Open this post in threaded view
|

Re: Looking for Lua Binaries for MSVC 2017

Antonio Scuri-2
  No problem. Glad it is working now.

Best,
Scuri


Em seg, 25 de mar de 2019 às 09:26, Dirk Laurie <[hidden email]> escreveu:
Op Ma. 25 Mrt. 2019 om 13:40 het Simon Orde
<[hidden email]> geskryf:
>
> Very sorry to have wasted your time, but thank you for looking into it for me.  It was a path issue.  I copied all the DLLs into the same folder as the release executable, but then tested it by running a debug executable which was located in a different folder.  Iup.dll and lua53.dll loaded fine – presumably because they had no non-system dependencies.  But iuplua53.dll required iup.dll and lua53.dll, and neither of these was on the PATH; nor were they in the current directory.  So they weren’t found.  And Dependencies didn’t pick it up because it apparently just looks in the same folder as the subject DLL when looking for dependent DLLs.  Which is fine if the subject DLL is loaded by an executable in that folder, but not otherwise.
>
> Anyway – my fault.  Apologies once again.

No need to apologise. This list is the right place for asking help,
even if you end up by finding the answer yourself. All problems look
elementary once the solution is pointed out.

-- Dirk

Reply | Threaded
Open this post in threaded view
|

Re: Looking for Lua Binaries for MSVC 2017

Coda Highland
In reply to this post by Dirk Laurie-2


On Mon, Mar 25, 2019 at 7:26 AM Dirk Laurie <[hidden email]> wrote:
Op Ma. 25 Mrt. 2019 om 13:40 het Simon Orde
<[hidden email]> geskryf:
>
> Very sorry to have wasted your time, but thank you for looking into it for me.  It was a path issue.  I copied all the DLLs into the same folder as the release executable, but then tested it by running a debug executable which was located in a different folder.  Iup.dll and lua53.dll loaded fine – presumably because they had no non-system dependencies.  But iuplua53.dll required iup.dll and lua53.dll, and neither of these was on the PATH; nor were they in the current directory.  So they weren’t found.  And Dependencies didn’t pick it up because it apparently just looks in the same folder as the subject DLL when looking for dependent DLLs.  Which is fine if the subject DLL is loaded by an executable in that folder, but not otherwise.
>
> Anyway – my fault.  Apologies once again.

No need to apologise. This list is the right place for asking help,
even if you end up by finding the answer yourself. All problems look
elementary once the solution is pointed out.

-- Dirk

On top of that, you shared the solution with the list, which means anyone else searching for answers in the future will learn from your efforts. Kudos!

/s/ Adam