[RFC PATCH] port: Provide ucrt compat functions required for mingw build.

Jacek Caban jacek at codeweavers.com
Wed Jan 2 10:11:12 CST 2019


Hi all,

Recent mingw-w64 changed quite a lot its crt to be able to support 
different runtime DLLs (most notably both msvcrt.dll and ucrtbase.dll at 
the same time). This requires some compat code to be used depending on 
which DLL is used. Compat code lives in the same libraries as are used 
as importlibs (like libmsvcrt.a). Wine doesn't use this library and 
generates its own import library instead. This library misses compat 
code required by mingw startup code. Commit 
32bac734632cf082da40a82de7f3135262688351 worked around the build problem 
by exporting more functions from our msvcrt. The problem is that those 
functions are not exported on Windows, so Wine DLLs compiled this way 
will fail to load on Windows.

The attached patch adds required compat code from mingw-w64 (it's mostly 
just a copy of its code). It's just a proof of concept - if we want 
that, we'd need to make sure it builds with old mingw-w64 first. The 
solution has its problems: for example we may need to extend that in the 
future if more such changes will happen to be needed on mingw-w64 side. 
Also __acrt_iob_func situation is even more tricky than onexit table 
functions. It's pulled by code that is so late in linker order, that 
linker will not pull it from our lib. It happens to work because it's in 
the same object file as other onexit table functions which are pulled 
earlier in the process (so using GC sections could break it).

It's not really nice, but it looks like a maintainable solution. 
Comments or better ideas are welcomed.

Jacek

---
  libs/port/Makefile.in |  1 +
  libs/port/ucrt.c      | 90 +++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 91 insertions(+)
  create mode 100644 libs/port/ucrt.c


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-port-Provide-ucrt-compat-functions-required-for-mingw.diff
Type: text/x-patch
Size: 2815 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20190102/8dba3687/attachment.bin>


More information about the wine-devel mailing list