Why, in Wine, are some unimplemented APIs not marked as stubs but instead commented out?
This results in a situation where, due to the missing API, the program doesn't report an error but instead directly aborts; whereas if it were marked as a stub, it would produce a clear error eg: https://github.com/wine-mirror/wine/blob/226a7eeabbc13345e49da1ff8c018d6f062... Does this involve some of wine's development philosophy?
If it's a stub, applications that link to it but don't actually call it works. If it's commented out, application might be able to handle its absence and fallback to other functions. Either way, if a application actually calls the function, it fails. So for such cases, you would need to implement the function. On 5/6/25 14:57, zhengxianwei wrote:
This results in a situation where, due to the missing API, the program doesn't report an error but instead directly aborts; whereas if it were marked as a stub, it would produce a clear error
eg: https://github.com/wine-mirror/wine/blob/226a7eeabbc13345e49da1ff8c018d6f062...
Does this involve some of wine's development philosophy?
Am 06.05.2025 um 10:13 schrieb Zhiyi Zhang <zzhang(a)codeweavers.com>:
If it's a stub, applications that link to it but don't actually call it works. If it's commented out, application might be able to handle its absence and fallback to other functions. Either way, if a application actually calls the function, it fails. So for such cases, you would need to implement the function.
I'll try to phrase it a bit differently: Many applications dynamically check if a function is available (via GetProcAddress). An @ stub will lead such an application to believe the function is there, attempt to call it, and crash. If the function is absent, it will fall back to alternatives and have a decent chance of working. This mostly concerns functions that are only available on some Windows versions. Usually they are introduced on newer Windows versions, but there are functions that exist on Windows 9x but not on the Windows NT line.
Thank you—after your explanation, the choice between using a stub or commenting out an unimplemented API makes much more sense On Tue, May 6, 2025 at 5:03 PM Stefan Dösinger <stefandoesinger(a)gmail.com> wrote:
Am 06.05.2025 um 10:13 schrieb Zhiyi Zhang <zzhang(a)codeweavers.com>:
If it's a stub, applications that link to it but don't actually call it works. If it's commented out, application might be able to handle its absence and fallback to other functions. Either way, if a application actually calls the function, it fails. So for such cases, you would need to implement the function.
I'll try to phrase it a bit differently: Many applications dynamically check if a function is available (via GetProcAddress). An @ stub will lead such an application to believe the function is there, attempt to call it, and crash. If the function is absent, it will fall back to alternatives and have a decent chance of working.
This mostly concerns functions that are only available on some Windows versions. Usually they are introduced on newer Windows versions, but there are functions that exist on Windows 9x but not on the Windows NT line.
participants (3)
-
Stefan Dösinger -
zhengxianwei -
Zhiyi Zhang