lua-users home
lua-l archive

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


  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 <SimonOrde@family-historian.co.uk> 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: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] 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