I execute command
gcc -dumpspecs >/local/specs.org
and then edit /local/specs.org file. I find 'msvcrt' word and delete all
text except '*libgcc:' section (which contains 'msvcrt' word). In my GCC
it looks like this:
*libgcc:
%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmingwex
-lmsvcrt
It could be longer line if you compile GCC without '--disable-shared'
option.
Then I copy file specs.org to specs.new and edit specs.new file to
change '-lmsvcrt' to '-lmsvcr120'. It looks like this:
*libgcc:
%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmingwex
-lmsvcr120
Then I copy both files specs.org and specs.new to
\lib\gcc\x86_64-w64-mingw32\5.3.0\ folder in GCC directory. If I want to
link to msvcr120.dll I copy 'specs.new' file to 'specs' file (without
any extension). If I want link to old msvcrt.dll I copy 'cpecs.old' file
to 'specs' file (I've made batch files to change this).
This is example for x86-64 version of GCC 5.3 compiled with actual trunk
version of mingw-w64 (which has 'libmsvcr120.a' file).
Why?
Many open source project uses 'll' (long long) size specification in
printf and scanf family functions. This not work in msvcrt.dll but works
perfect in msvcr120.dll. So I turn off '__USE_MINGW_ANSI_STDIO' in
'_mingw.h' header file and link to new msvcr120.dll. The printf family
functions from Microsoft DLLs are threads safe (actual trunk version of
mingw printf functions are threads safe too, but release 4.0.4 version
is not threads safe).
Second problem is C++ project x265. If you don't turn off
'__USE_MINGW_ANSI_STDIO' in '_mingw.h' header file each 'fprintf'
function is replaced by
int fprintf (FILE *__stream, const char *__format, ...)
{
register int __retval;
__builtin_va_list __local_argv; __builtin_va_start( __local_argv,
__format );
__retval = __mingw_vfprintf( __stream, __format, __local_argv );
__builtin_va_end( __local_argv );
return __retval;
}
which eats L1 cache for code that on my CPU is only 32 KiB. It makes EXE
file bigger and slower.
W dniu 2015-12-28 o 08:36, Baruch Burstein pisze:
On Thu, Dec 3, 2015 at 12:35 AM, Mateusz <mateu...@poczta.onet.pl
<mailto:mateu...@poczta.onet.pl>> wrote:
Sorry for previous patch -- I often link to msvcr120.dll instead
of msvcrt.dll.
I didn't know that was possible. How do you do that and why would you?
What is the advantage?
--
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public