load wx.dll
with LoadLibraryA
:
image.png (view on web)
unload dll with FreeLibrary
call ExitProcess
process crashs in nt.dll
, RtlpFlsDataCleanup
minimal example:
unzip the example.zip, and runs lua54.exe test.lua
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
It would be really great to have a minimal example, e.g. not involving Lua. Please write a tiny program calling LoadLibrary()
and FreeLibrary()
from C if you can.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
AFAICT, this is not a wxWidgets DLL.
Firstly, the name: wx.dll. This does not match the wxWidgets DLL naming pattern.
Secondly, looking at the DLL details in Explorer shows it is a wxLua library:
wx-dll-lua.png (view on web)
Lastly, program Dependencies shows it does not export wxWidgets classes, only wxLua (e.g., wxLuaModuleApp
) and it depends on lua54.dll.
All this means that you should report the issue to wxLua maintainers, not wxWidgets ones.
BTW, attempting to open this DLL in Dependency Walker (DW) makes DW freeze. I don't think I ever saw that with any other DLL (but I don't open that many in DW).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Thanks, I didn't even realize wx.dll
was the actuall DLL name and not a shortcut for "wxWidgets DLL".
We absolutely need a way to reproduce the problem using wx sources only, we can't do anything about any problems in DLLs that are not built by us.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Okay, I will try to build a pure wxWidgets DLL and a pure C program for it. Sorry for the noise from Lua binding (I'm noticing this
strange behavior when I trying to make a distro of some Lua bindings).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
FWIW, running this code built with MSVS 2022 as 64-bit console application on Windows 10
#include <windows.h> int main() { HMODULE wxDLL = LoadLibraryW(L"wx.dll"); if ( !wxDLL ) { LPVOID msgBuf; DWORD bufLen = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM , nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&msgBuf, 0, nullptr); if ( bufLen ) { MessageBoxW(nullptr, (LPCWSTR)msgBuf, L"ERROR", MB_OK | MB_ICONERROR); LocalFree(msgBuf); } else { MessageBoxW(nullptr, L"LoadLibrary(wx.dll) failed.", L"ERROR", MB_OK | MB_ICONERROR); } } else { FreeLibrary(wxDLL); } }
produces only the message box with an error message The specified module could not be found (probably lua54.dll). This IMO further confirms that the issue is in the lua54.DLL (in its DllMain()
?) and nothing do with wxWidgets itself.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@PBfordev I have tried this test program and it works well (I produced a lua54.dll for it). I think it's expected behavior. the wx.dll is from a Lua binding project for wxWidgets (wxLua).
The wxLua project static links the vs static libraries of wxWidgets and its binding code into one single dll, thus wx.dll
.
When it loaded from Lua, it's luaopen_wx
will be called, and some code runs. After that (I think) some fibers are created, but not freed when unload the DLL, so the ExitProcess
tries to free them and accessed the freed DLL address space and cause the crash.
I will look into the luaopen_wx
code and finding out what does it runs. And (maybe) report this bug to wxLua project.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@vadz @PBfordev this is a real minimal example:
wx-test.zip
Runs host.exe to see the crash in ntdll.dll
to build it, change the wxdir
in build.bat
and run. the wxWidgets used built as:
mkdir wx-build && cd wx-build
cmake -DwxBUILD_USE_STATIC_RUNTIME=ON -DCMAKE_INSTALL_PREFIX=%CD%/../wx-dist ../wxWidgets-3.2.5
cmake --build . --config Release
cmake --install .
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Is static runtime required to reproduce the problem?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.