3

gccand clang are both known to be compiler drivers. As such, the gcc executable does not compile anything itself. Rather, it calls the compiler (cc1), assembler (as) and linker (ld) with the right flags as needed.

Is this setup true also for the Microsoft C compiler, cl.exe? Is there actually some other executable that does the compilation? I assume that at least the assembling and linking are done by separate executables, since I know that ml.exe (known as MASM) and link.exe exist as separate executables, so cl.exe probably calls them.

Baruch
  • 157

1 Answers1

7

So the size of cl.exe is 158 KB. What do you think?

The rest of the MSVC C++ compiler is in various DLLs. The C/C++ compiler driver is officially cl.exe, but many of the driver functions are provided by MsBuild. Other executables include link.exe, lib.exe, ml.exe and bscmake.exe. You can't translate the archictecture or terminology blindly from one product set to another that is completely different.

However, if all you want to do is compile from the command line, cl.exe is the place to go. Details can be found here: https://stackoverflow.com/questions/7865432/command-line-compile-using-cl-exe.

david.pfx
  • 8,125
  • 2
    MsBuild is not "the driver". It's an optional build system, like make. – nobody Mar 26 '14 at 16:53
  • @AndrewMedico: You've got a point. See edit. – david.pfx Mar 27 '14 at 04:50
  • 2
    The front-end C compiler is c1.dll, the front-end C++ compiler is c1xx.dll, and c2.dll is the back-end optimizing code-generator. The edit you made did not fix the answer. MSBuild has nothing to do with the compiler. It is just a way of invoking the compiler. Link.exe is the linker, lib.exe is a helper app that creates/manages libraries, ml.exe is MASM (the assembler)... None of these have anything to do with the compiler, either! – Cody Gray - on strike Dec 14 '16 at 16:05
  • 1
    Moreover lib.exe is a shallow wrapper that effectively calls link.exe /lib ... similarly dumpbin.exe and editbin.exe. So even in that case the functionality only exists in one place (link.exe). Nothing to do with the compiler isn't entirely correct, though. But for all practical purposes it's the correct way of looking at things, I agree. – 0xC0000022L Sep 18 '23 at 19:43