On Thu, Dec 29, 2016 at 7:06 PM, <
marcb...@gmail.com> wrote:
> The main problem of linking to UCRT is the api sets. I have manage to
> generate the def files for UCRT. Let discus on the UCRT roadmap. One major
> issue is that I have no idea to make them in a single *. a file.
In principle this isn't too difficult, thought it may take a bit of
annoying work. .a files (also known as .lib files) are just "ar"
archives, where each entry in the archive is a tiny file containing
the symbol name, dll name, and some flags in a special format.
The PE/COFF spec is free:
https://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/pecoff_v83.docx
and it has a complete description of the .a file format in the section
"Archive (Library) File Format", and a complete description of the
files that you put into the .a file in the section "Import Library
Format". The two sections together are only 6 pages long. So in the
worst case, it's entirely possible to write a Python script to write
out the desired .a file directly.
> Another
> important thing is fixing the headers since several stdio functions are
> inside the header itself.
Yeah, the familiar stdio functions like vsprintf are implemented as
very very thin (~1 line) wrappers around functions like
__stdio_common_vsprintf, which is like vsprintf except that it takes
an extra flag to select between various compatibility options. This
shouldn't be terribly difficult to handle, but it does need to be done
:-).
One thing to watch out for here is that it's very easy to figure out
how this works by looking at the CRT header files *BUT* whoever does
that can't write the code, because of mingw-w64's clean-room rules.
One person has to look at the headers and put up a document describing
exactly what the magic flags are etc., and then someone else has to
write the code based on the public information. I'm already tainted,
so feel free to ask me for details :-).
-n
--
Nathaniel J. Smith --
https://vorpus.org