2

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.

  • clang process simply calls clang. It does not need to be a separate binary, but there is a reason to run phases in separate processes, for a better error recovery. – SK-logic Mar 4 '14 at 21:20
  • 1
    Why the downvotes? – Baruch Mar 6 '14 at 9:19
5

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.

  • 1
    MsBuild is not "the driver". It's an optional build system, like make. – Andrew Medico Mar 26 '14 at 16:53
  • @AndrewMedico: You've got a point. See edit. – david.pfx Mar 27 '14 at 4:50
  • 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 Dec 14 '16 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.