Re: [Mingw-w64-public] Calling wprintf from a C++ program

2017-11-08 Thread David Lee
Thanks for the reply. (1) Your observation seems to apply to the whole *wprintf() family (fwprintf(), swprintf(), etc), not just wprintf(). (2) On Windows with gcc/g++: (a) If I need to migrate some C code (using broken *wprintf()) into C++, and (b) the inclusion of stdio.h is to be change

Re: [Mingw-w64-public] Calling wprintf from a C++ program

2017-11-08 Thread Liu Hao
On 2017/11/9 12:13, David Lee wrote: Hello. I have an issue that isn't necessarily related to mingw-w64. Could be gcc/g++, libstdc++ or even my mistake. Let me have a starting point here. (... abridged ...) > [Question] Did I do something wrong or is the issue not related to mingw-w64? (it looks

[Mingw-w64-public] Calling wprintf from a C++ program

2017-11-08 Thread David Lee
Hello. I have an issue that isn't necessarily related to mingw-w64. Could be gcc/g++, libstdc++ or even my mistake. Let me have a starting point here. I downloaded Mingw-w64 GCC toolchains (5.4.0, 6.4.0, sjlj, x86 version) from here: https://sourceforge.net/projects/mingw-w64/files/Multilib%20Too

Re: [Mingw-w64-public] [PATCH 0/7] Ucrtbase/__argv/__p___* functions

2017-11-08 Thread Jacek Caban
On 08.11.2017 23:19, Martin Storsjö wrote: > - Fix getopt by using __p___argv there instead of __argv, as Jacek > suggested. In order to do this, I ended up cleaning up a few other > inconsistencies surrounding the build of msvcr* dlls/defs while > I was touching that area, cleanly separated

Re: [Mingw-w64-public] [PATCH 7/7] crt: Use __p___argv instead of __argv in getopt

2017-11-08 Thread Jacek Caban
On 08.11.2017 23:19, Martin Storsjö wrote: > We provide a version of __p___argv in all msvcrt versions now. This > allows linking getopt from libmingwex against ucrtbase. > > Signed-off-by: Martin Storsjö > --- > mingw-w64-crt/misc/getopt.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-)

Re: [Mingw-w64-public] [PATCH 3/7] crt: Only expose the __p___* functions in msvcrt.def on i386

2017-11-08 Thread Jacek Caban
On 08.11.2017 23:19, Martin Storsjö wrote: > When cleaning up post-unification differences in > 1035bed24e833ea5eb487c78f4f350ea48f31e8b, these were kept since I > thought they wouldn't be an issue (and I thought they weren't really > of much interest/use). For ucrtbase, there's a concrete need for

Re: [Mingw-w64-public] [PATCH 2/7] crt: Skip an i386 specific wrapper function for arm/arm64 msvcrt

2017-11-08 Thread Jacek Caban
On 08.11.2017 23:19, Martin Storsjö wrote: > There's no point in providing a wrapper for ___lc_codepage_func > on arm/arm64, since it is always available. > > Signed-off-by: Martin Storsjö > --- > mingw-w64-crt/Makefile.am | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Looks good to

Re: [Mingw-w64-public] [PATCH 6/7] crt: Provide __p___argv in all msvcrt versions

2017-11-08 Thread Jacek Caban
On 08.11.2017 23:19, Martin Storsjö wrote: > + // We have a fallback definition of __p___argv for msvcrt versions that > + // lack it, so always declare it as available, but without _CRTIMP. > + char ***__cdecl __p___argv(void); How about using __MINGW_IMP_SYMBOL in compat implementation so th

Re: [Mingw-w64-public] [PATCH 1/7] crt: Include LIBRARY in the def files for crtdll and msvcr80

2017-11-08 Thread Jacek Caban
On 08.11.2017 23:19, Martin Storsjö wrote: > This avoids special cased rules in Makefile.am, just to pass the > --dllname parameter. > > Signed-off-by: Martin Storsjö > --- > mingw-w64-crt/Makefile.am | 16 > mingw-w64-crt/lib32/crtdll.def | 1 + > mingw-w64-crt/lib

[Mingw-w64-public] [PATCH 4/7] headers: Restructure declarations of external variables like _argc

2017-11-08 Thread Martin Storsjö
This is in preparation for redefining these declarations for ucrtbase. Signed-off-by: Martin Storsjö --- mingw-w64-headers/crt/stdlib.h | 117 ++--- 1 file changed, 62 insertions(+), 55 deletions(-) diff --git a/mingw-w64-headers/crt/stdlib.h b/mingw-w64-head

[Mingw-w64-public] [PATCH 3/7] crt: Only expose the __p___* functions in msvcrt.def on i386

2017-11-08 Thread Martin Storsjö
When cleaning up post-unification differences in 1035bed24e833ea5eb487c78f4f350ea48f31e8b, these were kept since I thought they wouldn't be an issue (and I thought they weren't really of much interest/use). For ucrtbase, there's a concrete need for them, and that requires having their availability

[Mingw-w64-public] [PATCH 0/7] Ucrtbase/__argv/__p___* functions

2017-11-08 Thread Martin Storsjö
Hi, This is a subset of the uncommitted ucrtbase patches, with two major changes since yesterday: - I noticed that I had erroneously noted that __p___* functions existed everywhere. I had only checked the def file, and during unification (and even after later cleanups), I had left these new

[Mingw-w64-public] [PATCH 5/7] headers: Hook up __argc and similar external variables for ucrtbase

2017-11-08 Thread Martin Storsjö
Not all the variables that were listed seem to be exported from ucrtbase though, so only hook up those that do exist. Signed-off-by: Martin Storsjö --- This was approved previously by JonY, but is rebased on top of an updated patch. --- mingw-w64-headers/crt/stdlib.h | 48 +++

[Mingw-w64-public] [PATCH 1/7] crt: Include LIBRARY in the def files for crtdll and msvcr80

2017-11-08 Thread Martin Storsjö
This avoids special cased rules in Makefile.am, just to pass the --dllname parameter. Signed-off-by: Martin Storsjö --- mingw-w64-crt/Makefile.am | 16 mingw-w64-crt/lib32/crtdll.def | 1 + mingw-w64-crt/lib32/msvcr80.def.in | 1 + mingw-w64-crt/lib64/crtdll.def

[Mingw-w64-public] [PATCH 7/7] crt: Use __p___argv instead of __argv in getopt

2017-11-08 Thread Martin Storsjö
We provide a version of __p___argv in all msvcrt versions now. This allows linking getopt from libmingwex against ucrtbase. Signed-off-by: Martin Storsjö --- mingw-w64-crt/misc/getopt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-w64-crt/misc/getopt.c b/mingw-w64-cr

[Mingw-w64-public] [PATCH 6/7] crt: Provide __p___argv in all msvcrt versions

2017-11-08 Thread Martin Storsjö
In msvcrt.dll, it only existed on i386. In the numbered msvcr* DLLs, it was present in all of them except msvcr80.dll for x86_64. Signed-off-by: Martin Storsjö --- mingw-w64-crt/Makefile.am | 29 + mingw-w64-crt/misc/__p___argv.c | 12 mingw-w64-hea

[Mingw-w64-public] [PATCH 2/7] crt: Skip an i386 specific wrapper function for arm/arm64 msvcrt

2017-11-08 Thread Martin Storsjö
There's no point in providing a wrapper for ___lc_codepage_func on arm/arm64, since it is always available. Signed-off-by: Martin Storsjö --- mingw-w64-crt/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am in

Re: [Mingw-w64-public] [PATCH 00/11] More fixes for ucrtbase

2017-11-08 Thread Martin Storsjö
On Wed, 8 Nov 2017, JonY via Mingw-w64-public wrote: On 11/07/2017 09:29 PM, Martin Storsjö wrote: I've tested our support for ucrtbase.dll a bit further by trying building a handful of libraries with it, and fixing the issues I run into. With these patches, I'm able to build among others Qt (t

Re: [Mingw-w64-public] [PATCH 09/11] crt: Add compatibility for __imp___argv for ucrtbase

2017-11-08 Thread Martin Storsjö
On Wed, 8 Nov 2017, Jacek Caban wrote: Hi Martin, On 11/7/17 10:29 PM, Martin Storsjö wrote: Normally calling code should use the right version of headers, but the getopt implementation in libmingwex will have a hardcoded reference to __imp___argv. I think it would be better to add __p___ar

Re: [Mingw-w64-public] [PATCH 02/11] headers: Remove unnecessary ifdefs around __p_* functions

2017-11-08 Thread Martin Storsjö
On Tue, 7 Nov 2017, Martin Storsjö wrote: These are available in all versions of msvcrt, also on x86_64. Signed-off-by: Martin Storsjö --- mingw-w64-headers/crt/stdlib.h | 2 -- 1 file changed, 2 deletions(-) Actually, this turns out to not be true. In my collection of msvcrt dlls, it does e

Re: [Mingw-w64-public] [PATCH 00/11] More fixes for ucrtbase

2017-11-08 Thread JonY via Mingw-w64-public
On 11/07/2017 09:29 PM, Martin Storsjö wrote: > I've tested our support for ucrtbase.dll a bit further by trying building > a handful of libraries with it, and fixing the issues I run into. With > these patches, I'm able to build among others Qt (tested with 5.7.1). > > Some libraries have an issu

Re: [Mingw-w64-public] [PATCH 00/11] More fixes for ucrtbase

2017-11-08 Thread Jacek Caban
On 08.11.2017 14:30, Martin Storsjö wrote: > On Wed, 8 Nov 2017, Jacek Caban wrote: > >> Hi Martin, >> >> >> On 11/7/17 10:29 PM, Martin Storsjö wrote: >>> I've tested our support for ucrtbase.dll a bit further by trying >>> building >>> a handful of libraries with it, and fixing the issues I run i

Re: [Mingw-w64-public] [PATCH 00/11] More fixes for ucrtbase

2017-11-08 Thread Martin Storsjö
On Wed, 8 Nov 2017, Jacek Caban wrote: Hi Martin, On 11/7/17 10:29 PM, Martin Storsjö wrote: I've tested our support for ucrtbase.dll a bit further by trying building a handful of libraries with it, and fixing the issues I run into. With these patches, I'm able to build among others Qt (teste

Re: [Mingw-w64-public] [PATCH 11/11] crt: Provide compat wrappers for the unprefixed "timezone" and "tzname"

2017-11-08 Thread Martin Storsjö
On Wed, 8 Nov 2017, Jacek Caban wrote: Hi Martin, On 07.11.2017 22:29, Martin Storsjö wrote: Alternatively, we could just skip providing these when building with ucrtbase, but that would require updating any calling code. That's a tempting solution. It seems to be deprecated for years now.

Re: [Mingw-w64-public] [PATCH 11/11] crt: Provide compat wrappers for the unprefixed "timezone" and "tzname"

2017-11-08 Thread Jacek Caban
Hi Martin, On 07.11.2017 22:29, Martin Storsjö wrote: > Alternatively, we could just skip providing these when building with > ucrtbase, but that would require updating any calling code. That's a tempting solution. It seems to be deprecated for years now. Do you know a real code that needs it? H

Re: [Mingw-w64-public] [PATCH 10/11] headers: Provide timezone/dstbias/tzname/daylight for ucrtbase

2017-11-08 Thread JonY via Mingw-w64-public
On 11/07/2017 09:29 PM, Martin Storsjö wrote: > Signed-off-by: Martin Storsjö Patch OK. signature.asc Description: OpenPGP digital signature -- Check out the vibrant tech community on one of the world's most engaging te

Re: [Mingw-w64-public] [PATCH 08/11] headers: Redirect f{seek, tell}o{, 64} to fseek/ftell/_fseeki64/_ftelli64 for ucrtbase

2017-11-08 Thread JonY via Mingw-w64-public
On 11/07/2017 09:29 PM, Martin Storsjö wrote: > We don't want to call the normal fseeko/ftello wrappers in libmingwex > in this case. > > Signed-off-by: Martin Storsjö Looks OK to me. signature.asc Description: OpenPGP digital signature -

Re: [Mingw-w64-public] [PATCH 06/11] headers: Use the single argument version of setjmp for ucrtbase

2017-11-08 Thread JonY via Mingw-w64-public
On 11/07/2017 09:29 PM, Martin Storsjö wrote: > Signed-off-by: Martin Storsjö > --- > mingw-w64-headers/crt/setjmp.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Patch OK. signature.asc Description: OpenPGP digital signature --

Re: [Mingw-w64-public] [PATCH 05/11] headers: Hook up __argc and similar external variables for ucrtbase

2017-11-08 Thread JonY via Mingw-w64-public
On 11/07/2017 09:29 PM, Martin Storsjö wrote: > Not all the variables that were listed seem to be exported from > ucrtbase though. > > Signed-off-by: Martin Storsjö Patch OK. signature.asc Description: OpenPGP digital signature -

Re: [Mingw-w64-public] [PATCH 03/11] headers: Remove an incorrect declaration of "environ" when _POSIX_ is defined

2017-11-08 Thread JonY via Mingw-w64-public
On 11/07/2017 09:29 PM, Martin Storsjö wrote: > There is nothing in our crt parts, neither compat wrappers nor > import libraries, that defines a variable named "environ" without > a leading underscore. > > Signed-off-by: Martin Storsjö Patch OK. signature.asc Description: OpenPGP digital sig

Re: [Mingw-w64-public] [PATCH 02/11] headers: Remove unnecessary ifdefs around __p_* functions

2017-11-08 Thread JonY via Mingw-w64-public
On 11/07/2017 09:29 PM, Martin Storsjö wrote: > These are available in all versions of msvcrt, also on x86_64. > > Signed-off-by: Martin Storsjö Patch OK. signature.asc Description: OpenPGP digital signature -- Check