<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jan 19, 2020 at 12:27 PM Martin Storsjö <<a href="mailto:martin@martin.st" target="_blank">martin@martin.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sun, 19 Jan 2020, Russell Haley via cfe-dev wrote:<br>
<br>
> I think there is a separate aspect to what you are asking, which<br>
> is, even if you take all of clang as it is, it is still not<br>
> quite enough to compile and link C code into a DLL. You<br>
> typically need SDK headers (windows.h) and a standard C library<br>
> (MSVCRT or mingw). LLVM doesn't provide this, and you have to<br>
> get it from Microsoft or mingw.<br>
> <br>
> Yes, I'm aware of the need for a standard library. I'm researching if I can<br>
> re-distribute the header and lib files from the MSVC Build Tools download. A<br>
> brief reading of their license indicates that I cannot redistribute the<br>
> *debug* binaries but doesn't say anything about the headers or lib files. A<br>
> second possible approach as suggested by Zachary Turner would be to compile<br>
> the mingw library with clang and include it but I don't necessarily want<br>
> posix support compared to the MS libc (also noted by Mr. Turner). <br>
<br>
As far as I know, those files aren't redistributable. The fact that they <br>
aren't is one of the primary reasons for mingw in itself.<br>
<br>
Also do note that mingw doesn't provide posix support; mingw primarily <br>
intends to provide a freely redistributable "sdk" for pure native windows <br>
code, allowing you to build executables that only rely on the CRT DLLs <br>
(the windows internal msvcrt.dll, and recently, the UCRT) that ship with <br>
windows itself (to allow building GPL code and redistributing it).<br>
<br>
In addition to the CRT and the windows APIs themselves, mingw does provide <br>
a few extra posix originated APIs (usleep, getopt and a few other similar <br>
ones), but this is mostly an exception.<br>
<br>
This is contrary to cygwin, which provides a full posix environment (fork <br>
and all), but requires linking everything to their runtime, and generally <br>
behaves as an isolated environment from the rest of windows.<br>
<br>
If what you want is clang + a redistributable sdk, I just so happen to <br>
have that prepackaged for you, at <a href="https://github.com/mstorsjo/llvm-mingw" rel="noreferrer" target="_blank">https://github.com/mstorsjo/llvm-mingw</a>. <br>
The packed release is around 150 MB, and the unpacked release weighs in at <br>
around 500 MB at the moment, but if you remove import libraries for three <br>
out of four architectures, LLDB and lesser used tools like llvm-objdump, <br>
llvm-nm etc, you can get it down to slightly above 200 MB.<br>
<br>
// Martin<br></blockquote><div><br></div><div>That sounds exactly like what I'm trying to achieve.</div><div><br></div><div>You may have answered a question I've had for some time: "Does mingw require a redistributable"? It sounds like the answer is "whenever linking to non-standard Windows API calls". If that's the case, how does one get that redistributable and/or know when it's required?</div><div><br></div><div>Many thanks!</div><div>Russell</div></div></div>