Using VS 2017 / cmake 3.30.1 / Windows 10
cmake -DwxBUILD_SAMPLES=SOME -DwxBUILD_SHARED=OFF G:\wxWidgets
Output:
-- Which libraries should wxWidgets use?
wxUSE_REGEX: builtin (enable support for wxRegEx class)
wxUSE_ZLIB: builtin (use zlib for LZW compression)
wxUSE_EXPAT: builtin (use expat for XML parsing)
wxUSE_LIBJPEG: builtin (use libjpeg (JPEG file format))
wxUSE_LIBPNG: builtin (use libpng (PNG image format))
wxUSE_LIBTIFF: builtin (use libtiff (TIFF file format))
wxUSE_NANOSVG: builtin (use NanoSVG for rasterizing SVG)
wxUSE_LIBLZMA: OFF (use liblzma for LZMA compression)
wxUSE_WEBVIEW: ON (enable wxWebview with IE)
-- Configured wxWidgets 3.3.0 for Windows
Min OS Version required at runtime: Windows 7 / Windows Server 2008
Which GUI toolkit should wxWidgets use? msw
Should wxWidgets be compiled into single library? OFF
Should wxWidgets be linked as a shared library? OFF
Which wxWidgets API compatibility should be used? 3.2
-- Configuring done (25.6s)
-- Generating done (0.3s)
-- Build files have been written to: G:/wxWidgets-cmake
Opening wxWidgets.sln and building everything gives no error.
But running the "minimal" sample fails with:
"The value of ESP was not properly saved across a function call"
wx-cmake-error.png (view on web)
Usually that means different built settings between libraries and application, but i couldn't spot any significant difference.
Building wxWidgets libs and the minimal sample using the provided (not cmake generated) solutions still works.
BTW:
Adding -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" to the command line is supposed to link the CRT statically, but this didn't work for me. But that's a different issue.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
I can reproduce it too (vs2022), only with the 32-bit build, static and shared. Seems a regression of 229b749 (Merge wxMSWCommandLineInit and wxInitData structs).
Even with the debugger it seems unclear to me what is going on. It starts in wxEntry
and then suddenly it is in wxEntryStart
getting invalid data from wxInitData::Get()
. Also in shared build it complains about initializing multiple times.
Maybe CMake is missing a msvc option (or uses an extra one) that causes the problem. I'll try to narrow it down.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
I also get similar problems with the 32-bit build using minimal_vc17.sln
, but only the DLL debug/release builds.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
I might have found the problem, wxInitData().Get().MSWInitialize();
should be wxInitData::Get().MSWInitialize();
(Probably) unrelated, but wxEntryStart
and wxEntry
use different export defines, shouldn't these be the same?
include/wx/msw/init.h | 4 ++-- src/msw/main.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/wx/msw/init.h b/include/wx/msw/init.h index 8cacdb2c36..354bd58e71 100644 --- a/include/wx/msw/init.h +++ b/include/wx/msw/init.h @@ -34,13 +34,13 @@ typedef char *wxCmdLineArgType; // Windows-only overloads of wxEntry() and wxEntryStart() which take the // parameters passed to WinMain() instead of those passed to main() -extern WXDLLIMPEXP_CORE bool +extern WXDLLEXPORT bool wxEntryStart(HINSTANCE hInstance, HINSTANCE hPrevInstance = nullptr, wxCmdLineArgType pCmdLine = nullptr, int nCmdShow = SW_SHOWNORMAL); -extern WXDLLIMPEXP_CORE int +extern WXDLLEXPORT int wxEntry(HINSTANCE hInstance, HINSTANCE hPrevInstance = nullptr, wxCmdLineArgType pCmdLine = nullptr, diff --git a/src/msw/main.cpp b/src/msw/main.cpp index 502a8fda21..b2e03c3a5d 100644 --- a/src/msw/main.cpp +++ b/src/msw/main.cpp @@ -202,7 +202,7 @@ wxMSWEntryCommon(HINSTANCE hInstance, int nCmdShow) wxUnusedVar(nCmdShow); #endif - wxInitData().Get().MSWInitialize(); + wxInitData::Get().MSWInitialize(); return true; } @@ -241,7 +241,7 @@ WXDLLEXPORT int wxEntry(HINSTANCE hInstance, int wxEntry() { - wxInitData().Get().MSWInitialize(); + wxInitData::Get().MSWInitialize(); auto& initData = wxInitData::Get(); return wxEntry(initData.argc, initData.argv);
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Oops, thanks a lot for finding this, it should definitely be wxInitData::Get()
. I think the ctor could/should be made private to prevent the wrong variant from compiling.
WXDLLEXPORT
is the same as WXDLLIMPEXP_CORE
and the latter is more explicit, so I'd rather keep using it.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Then maybe the implementation in src/msw/main.cpp
should be modified to use WXDLLIMPEXP_CORE
as well. Those use currently WXDLLEXPORT
.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.