#48962: Error starting c++ program linking to libstdc++-6.dll on Windows 9x without KernelEx Open Date: 2023-12-30 10:41 Last Update: 2024-02-08 18:20 URL for this Ticket: https://osdn.net//projects/mingw/ticket/48962 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=48962 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2024-02-08 18:20 Updated by: keith Comment: Reply To qiannangong I've attached a screenshot from a Windows 98 SE VM to reproduce this issue. So, failure occurs before the dynamic linker (a.k.a. the Windows program loader) even attempts to pass control to the program entry point. Failure is the result of the dynamic linker's attempt to resolve a CreateHardLinkW() reference, while loading libstdc++-v6.dll; as you have noted, this symbol is not present in Win9x;s kernel32.dll (whence it is expected to be exported). Technically, this is a gratuitous misuse of the CreateHardLink() API, within libstdc++-v6.dll, (which is maintained by the GCC project, not by us). However, the GCC project team are unlikely to view any related bug report sympathetically; they are more likely to dismiss it, on the premise that Win9x is no longer supported. Thus, we need to provide our own workaround, if we wish to preserve such legacy support. A possible solution may be to remove the gratuitous declaration of CreateHardLinkW at 12, as a libkernel32.dll export, from our kernel32.def source file, and add a pre-compiled variant of the stub code, which I suggested previously, to our libkernel32.a import library. I can make this modification, and post it here, but I will need your participation to test it, before I incorporate it formally into our w32api distribution. And btw, LTO is not available on Windows 9x either. That certainly appears to be the case. However, you have already demonstrated the solution; you may wish to add the -fno-lto option to your GCC specs file, on your Win9x platform, to ensure that it is always specified, when you compile on that platform. --------------------------------------------------------------------- Ticket Status: Reporter: qiannangong Owner: (None) Type: Issues Status: Open Priority: 5 - Medium MileStone: (None) Component: (None) Severity: 5 - Medium Resolution: None --------------------------------------------------------------------- Ticket details: LIBSTDC++-6.DLL bundled in latest package requires an export named CreateHardLinkW in KERNEL32.DLL, which seems not to be available on vanilla Windows 9x platform... However, A static linked program may work only if it does not use the APIs may refer to the CreateHardLinkW. -- Ticket information of MinGW - Minimalist GNU for Windows project MinGW - Minimalist GNU for Windows Project is hosted on OSDN Project URL: https://osdn.net/projects/mingw/ OSDN: https://osdn.net URL for this Ticket: https://osdn.net/projects/mingw/ticket/48962 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=48962