#42344: Implement a generic infrastructure to facilitate run-time linking of API functions Open Date: 2021-05-21 20:46 Last Update: 2021-05-25 16:48 URL for this Ticket: https://osdn.net//projects/mingw/ticket/42344 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=42344 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2021-05-25 16:48 Updated by: keith * Resolution Update from None to Accepted Comment: Well it appeared to be working, so I committed 7b37e9a. I then moved on to ticket #42383, which unfortunately revealed a careless logic error ... corrected by commit e5e5f06. --------------------------------------------------------------------- Ticket Status: Reporter: keith Owner: keith Type: Feature Request Status: Open [Owner assigned] Priority: 5 - Medium MileStone: (None) Component: WSL Severity: 5 - Medium Resolution: Accepted --------------------------------------------------------------------- Ticket details: As support for new (Windows version-dependent) APIs is added to MinGW, there is increased potential for creating an application which will not load, much less run, on legacy Windows versions; the typical manifestation of such a load failure is that the process crashes with an "entry point not found" exception, for the unsupported DLL function, before the main() function even gets control, so there's no opportunity to handle the exception. The only way to mitigate such exceptions, such that the application retains control, is to always link potentially unsupported API functions dynamically, at run-time, by retrieval of an entry-point reference, using GetProcAddress(), and to always invoke the function via the reference pointer, (and never call it directly, by name). The mechanism for dynamically linking such functions is mostly the same, in each case, often resulting in significant repetitive coding; it would be a great convenience, if MinGW were to implement a generic API infrastructure, to encapsulate the common features of the required run-time linking interface. -- 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/42344 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=42344