Visual C++ compiler really have asm compiler inside or it is separate program?

Started by Spartan, June 16, 2006, 02:01:25 PM

Previous topic - Next topic

Spartan

My friend Igor said that VC++ compiler has outsideĀ  asm compiler. what is true?

Ossa

I'm not too sure what your question here is... but I'll take my best guess:

The VC++ compiler (cl.exe) compiles C/C++ code. There is a seperate assembler called MASM (ml.exe) that is often but not always packaged with it. You can also use inline ASM code in your C/C++, but that is assembled by cl.exe.

Hope that answers your question,
Ossa
Website (very old): ossa.the-wot.co.uk

asmfan

He is right it is called ml.exe, but cl.exe can assemble inline asm instructions as well...
Russia is a weird place

Spartan

But  why use the ml.exe if cl.exe can compile asm code?
And second question - what better to use ml.exe or cl.exe for compiling asm subroutins?

Ossa

Hi again,

Quote from: Spartan on June 16, 2006, 02:12:52 PM
But  why use the ml.exe if cl.exe can compile asm code?

cl.exe can only assemble inline asm. It is very troublesome to code entire modules in asm from cl.exe, whilst ml.exe is setup to do exactly that.

Quote from: Spartan on June 16, 2006, 02:12:52 PM
And second question - what better to use ml.exe or cl.exe for compiling asm subroutins?

It depends on what you want to do. If you have subroutines composed of pure asm (no C/C++ what-so-ever) then use MASM. If the ASM forms only a small part of the routines, use inline ASM with cl.exe.

Ossa
Website (very old): ossa.the-wot.co.uk

hutch--

CL.EXE and ML.EXE are very different tools and they respectively do their own tasks very well if properly understood but they line up with the output which is both COFF Microsoft format object modules and this make correctly written procedures in both usable by either. Both are fully application capable yet both can be used with each other to produce binay files so its really a case of pick what you need and write it to do that job.

Modern compiler design does not like inline asm as it messes up register allocation so in most instances, you are better off writing assembler code in MASM and linking the object module in VC projects. It works just as well the other way if you want a C algo in a MASM program.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php