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.

2
  • 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, 2014 at 21:20
  • 2
    Why the downvotes?
    – Baruch
    Mar 6, 2014 at 9:19

1 Answer 1

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.

4
  • 2
    MsBuild is not "the driver". It's an optional build system, like make.
    – nobody
    Mar 26, 2014 at 16:53
  • @AndrewMedico: You've got a point. See edit.
    – david.pfx
    Mar 27, 2014 at 4: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! Dec 14, 2016 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. Sep 18, 2023 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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