On Fri, 17 May 2019, Jacek Caban wrote:
On 5/17/19 10:11 PM, Martin Storsjö wrote:
On Fri, 17 May 2019, Jacek Caban wrote:
I see it now. The problem seems to be wider than assert and caused by
__set_app_type call in ucrtbase_main.c. If I remove them, it behaves
correctly. Do you remember it's called there? Note that crtexe.c already
sets app type correctly, but it's broken by __getmainargs later.
I think the reason why I added the __set_app_type call in __getmainargs, is
that I checked with the wine implementation of the function for hints about
what it should do, when implementing this for the ucrt compat wrapping.
Wine's function looks like this:
int CDECL __getmainargs(int *argc, char** *argv, char** *envp,
int expand_wildcards, int *new_mode)
{
...
if (new_mode)
MSVCRT__set_new_mode( *new_mode );
return 0;
}
But now when looking at the mingw-w64 crt code, I see that *new_mode always
is 0 here - so apparently msvcrt.dll doesn't actually use the parameter in
this exact way.
new_mode seems to be something different than app type and we could probably
use _set_new_mode for that, but we should be fine ignoring it.
Oh, I somehow have misread this all the time, I read MSVCRT__set_new_mode
as MSVCRT__set_app_type.
Well then it's exceptionally clear.
I tried including new.h and calling _set_new_mode(), but apparently all of
new.h is hidden behind an #ifdef __cplusplus, so the current declaration
isn't visible to be called from C code.
// Martin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public