Skip to content

Commit 963e5e1

Browse files
committed
fix(eui-neo): pin the Windows API floor and name kernel32 for app-main
Auditing the one TU the `app-main` feature adds — which nothing in this index compiled until tests/examples/eui-neo-app-main existed — turned up two Windows-only requirements it carries: * core/app/frame_pacing.h calls CreateWaitableTimerExW, and both mingw-w64's winbase.h and the Windows SDK guard that declaration behind `#if _WIN32_WINNT >= 0x0600`. The header sets no floor of its own, so it inherits the toolchain default, and mingw-w64 has historically defaulted as low as 0x502. Pin 0x0A00 in cflags + cxxflags rather than depend on which default the runner's llvm ships — that is effectively what upstream builds against via the MSVC SDK, and a command-line define is respected by _mingw.h's `#ifndef` guard. Every other Windows API in the package is pre-Vista, which is why this never surfaced. * the same header reaches CreateWaitableTimerExW / SetWaitableTimer / WaitForSingleObject / CloseHandle, so name -lkernel32. It is in every sane default lib set, but the surrounding comment is specifically about mcpp not inheriting CMake's CMAKE_C_STANDARD_LIBRARIES, so spelling it out is consistent and free. timeBeginPeriod (winmm) and MonitorFromWindow / GetMonitorInfoW / EnumDisplaySettingsW (user32) were already covered; glfw3native.h ships in compat.glfw's include/GLFW/. Linux is unaffected (the flags are inside the `windows` section) and all three eui-neo members re-verified green there.
1 parent 675a544 commit 963e5e1

2 files changed

Lines changed: 46 additions & 7 deletions

File tree

‎.agents/docs/2026-07-30-eui-neo-window-and-app-main-members.md‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,25 @@ the build+link half of both members on those platforms is asserted by the
188188
`workspace (macos)` / `workspace (windows)` legs, not locally. Two things are new
189189
there and worth watching on the first run:
190190
191-
* `glfw_app_main.cpp` has never been compiled on any platform. Its Windows half
192-
(`<mmsystem.h>`, `GLFW_EXPOSE_NATIVE_WIN32`, `glfw3native.h`, `timeBeginPeriod`,
193-
`MonitorFromWindow`, `EnumDisplaySettingsW`) needs `-lwinmm` and `-luser32`, both
194-
already in the descriptor's `windows.ldflags`.
191+
* `glfw_app_main.cpp` has never been compiled on any platform, so its Windows half
192+
is newly exercised. Two descriptor additions came out of auditing it, both
193+
Windows-only and both for that TU alone:
194+
195+
* **`-D_WIN32_WINNT=0x0A00`** (cflags + cxxflags). `core/app/frame_pacing.h`
196+
calls `CreateWaitableTimerExW`, which mingw-w64's `winbase.h` and the Windows
197+
SDK both guard behind `#if _WIN32_WINNT >= 0x0600`. The header sets no floor of
198+
its own and mingw-w64 has historically defaulted as low as `0x502`, so the
199+
build would depend on which default the runner's llvm ships. Everything else in
200+
the package only reaches pre-Vista APIs, which is why it never came up.
201+
* **`-lkernel32`**. `frame_pacing.h` reaches `CreateWaitableTimerExW` /
202+
`SetWaitableTimer` / `WaitForSingleObject` / `CloseHandle`. kernel32 is in
203+
every sane default lib set, so this is belt-and-braces — but the surrounding
204+
comment in the descriptor is precisely about mcpp not inheriting CMake's
205+
`CMAKE_C_STANDARD_LIBRARIES`, so naming it is consistent and free.
206+
207+
`timeBeginPeriod` (winmm) and `MonitorFromWindow` / `GetMonitorInfoW` /
208+
`EnumDisplaySettingsW` (user32) were already covered by the existing list;
209+
`glfw3native.h` ships in compat.glfw's `include/GLFW/`.
195210
* these are the first members to link `compat.glfw` off Linux from their **own** code
196211
rather than through `compat.eui-neo`, which exercises the macOS
197212
`Cocoa`/`IOKit`/`CoreFoundation` frameworks and the Windows `-lgdi32` from a

‎pkgs/e/compat.eui-neo.lua‎

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,20 @@ package = {
309309
-- through eui_neo.h), hence both lists; EUI_TRAY_WINAPI only gates
310310
-- tray_bridge.c, but keeping the pair symmetrical is cheaper than
311311
-- re-deriving which is which.
312-
cflags = { "-DEUI_TRAY_WINAPI=1", "-DNOMINMAX" },
312+
--
313+
-- `_WIN32_WINNT` is for the `app-main` feature's TU, which nothing
314+
-- compiled until tests/examples/eui-neo-app-main existed:
315+
-- core/app/frame_pacing.h calls CreateWaitableTimerExW, and both
316+
-- mingw-w64's winbase.h and the Windows SDK guard that declaration
317+
-- behind `#if _WIN32_WINNT >= 0x0600`. The header sets no floor of
318+
-- its own, so it inherits the toolchain default — mingw-w64 has
319+
-- historically defaulted as low as 0x502. Pin the floor rather than
320+
-- depend on which default the runner's llvm ships; 0x0A00 is what
321+
-- upstream effectively builds against via the MSVC SDK, and a
322+
-- command-line define is respected by _mingw.h's `#ifndef` guard.
323+
-- The rest of the package only reaches pre-Vista APIs, which is why
324+
-- this never came up before.
325+
cflags = { "-DEUI_TRAY_WINAPI=1", "-DNOMINMAX", "-D_WIN32_WINNT=0x0A00" },
313326
-- Upstream builds at CMAKE_CXX_STANDARD 17; this index's floor is
314327
-- c++23, and one Windows-only line does not survive the move:
315328
-- `parseWindowsSelection()` in core/platform/platform.cpp pushes
@@ -326,7 +339,8 @@ package = {
326339
-- already sits eight lines above and does the right thing); until
327340
-- then this keeps us on a real upstream release tag rather than a
328341
-- fork carrying the patch.
329-
cxxflags = { "-DEUI_TRAY_WINAPI=1", "-DNOMINMAX", "-fno-char8_t" },
342+
cxxflags = { "-DEUI_TRAY_WINAPI=1", "-DNOMINMAX", "-fno-char8_t",
343+
"-D_WIN32_WINNT=0x0A00" },
330344
-- Upstream lists winmm/urlmon/shell32/user32/imm32/pdh and stops
331345
-- there, because CMake's MSVC default `CMAKE_C_STANDARD_LIBRARIES`
332346
-- already drags in kernel32/user32/gdi32/shell32/ole32/comdlg32/…
@@ -337,10 +351,20 @@ package = {
337351
-- URLDownloadToFileA and ShellExecuteA are covered by the upstream
338352
-- list.) Like the char8_t break above, this only showed up once the
339353
-- mcpp#233 collision stopped dropping the TU.
354+
--
355+
-- kernel32 for the `app-main` TU: core/app/frame_pacing.h reaches
356+
-- CreateWaitableTimerExW / SetWaitableTimer / WaitForSingleObject /
357+
-- CloseHandle, and glfw_app_main.cpp reaches timeBeginPeriod (winmm,
358+
-- already listed) plus MonitorFromWindow / GetMonitorInfoW /
359+
-- EnumDisplaySettingsW (user32, already listed). kernel32 is part of
360+
-- every sane Windows default lib set, so this is belt-and-braces for
361+
-- the one TU in this package that had never been compiled — naming
362+
-- it costs nothing and the comment above is precisely about mcpp not
363+
-- inheriting CMake's defaults.
340364
ldflags = {
341365
"-lwinmm", "-lurlmon", "-lshell32",
342366
"-luser32", "-limm32", "-lpdh", "-lole32",
343-
"-lcomdlg32",
367+
"-lcomdlg32", "-lkernel32",
344368
},
345369
},
346370

0 commit comments

Comments
 (0)