FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0257 — Windows: SDL2 linked statically three times
ID 0257
Class ARCHITECTURE
Severity 2
Status ready

Models: —

Found: 2026-11-26, FhVis on Windows made no render window.

Evidence

SDL 2 is linked statically into FhVis.exe, fhVisDll.dll and OgreBites.dll on Windows. Each copy has its own state. FhVisWindowContext::CreateRenderWindow called fhsim::visual::StartSdlVideo() (WindowSystem.cpp:44) first. That ran in fhsim's copy and registered the window class "SDL_app". OgreBites' copy then failed RegisterClassEx for the same name, SDL_Appname became NULL and SDL_CreateWindow returned NULL. OgreApplicationContextSDL (Ogre 14.6.2, OgreApplicationContextSDL.cpp:57-68) then passed garbage as externalWindowHandle. ogre.log showed sdlwin=0 and a window of 1280x0 on D3D11. On GL3Plus selectPixelFormat failed. D3D11 does not throw on a bad handle.

Effect

The input SDL calls (pollEvents in OgreBites) go to a copy that has no window. A work-around in FhVisWindowContext (create the window first on Windows, throw on a null native handle) hides it. Any other SDL call made from fhsim's own copy can fail the same way.

Possible fix

Lasting fix: one shared SDL (a shared library) in conan/set.profile, with ogre3d rebuilt against it.

Test that would prove it

fhvis-window-windows (DRIVER=windows) on a Windows build, with fhsim and OgreBites sharing one SDL.

Risk

Rebuilds ogre3d and every consumer on Windows.