Pali Rohár <[email protected]> wrote: > On Sunday 30 August 2026 10:02:22 Kirill Makurin wrote: >> From looking at mingw-w64-crt/Makefile.am, one way I see how we can do this >> is rename src_libmingwex_{arch} variables and add these source files to each >> import library; it seems like src_msvcrt_common_add_{arch} variables can be >> used for this. And then, simply use an empty file as sources for >> libmingwex.a. > > This would increase number of object files which needs to be produced > because source files for each import library is compiled separately. > And therefore it will slow down compilation of the whole mingw-w64.
You're right. At some point I realized that each source file compiled once for each import library it is included in. > I would rather propose to rename libmingwex.a to something like > libcrt_common.a, mark it to not be installed and then via MRI scripts > merge this library into each CRT import library. This will ensure that > source files are compiled only once (like now). >(Of course then add a new empty libmingwex.a library which would be > installed.) Given that list of functions included into such libcrt_common.a may vary, how easy it will be to write MRI script to properly handle it? I'm aware of what MRI scripts are, but never wrote one myself. > And same thing should be done with those "src_(pre|post)_msvcr*" source > files. Each one can be compiled and put into own .a library and then via > MRI script merged into appropriate import library. Because right now > for example all files specified in "src_pre_msvcr120" are compiled for > each CRT import library individually and in the same way. As another approach, I was thinking whether we could make use of the fact that each source file is compiled for each import library it is included in. If we were able to define a per-import-library macro which tells which CRT the file is compiled on, we could have conditional code specific to that CRT. Currently, if we need to compile the same function differently for different CRTs, we need to have separate source files for each version. If we had this information, we could have single source file for all versions and compile it differently depending on CRT (when needed). I have impression that you are not a fan of such conditional code though. Anyway, this is just something I was thinking about. A few potential improvements I see in this approach are: 1. Documentation; all important information for a function (e.g. what issues it has in what CRTs) is now in single file 2. It makes it harder to forget about other version(s) when updating some function - Kirill Makurin _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
