News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

ml.exe meme behavior

Started by alCoPaUL, May 27, 2024, 03:32:34 AM

Previous topic - Next topic

alCoPaUL

from vs buildtools 2015-> 2019-> 2022,

ml.exe inserts a "_" on main, printf and sprintf_s.

making _main, _printf, _sprintf_s in the object files.

which makes it impossible (for me at least) to link them even with the modern .lib files to be included..

coz ml-ed .obj files only links with no "_" (there are few exceptions tho like older .libs (visual studio 2010) or custom built .lib files (i.e. MASM32SDK from here..))

address the problem via source code and it will just put 2 "_"

like "__printf" (you get the point)..

/Cx /Cu /Cp don't remove the prepended "_"

or am i missing something?

"or is this some meme octagon again?"

so anyway, how's your ml.exe's there in your PCs? is it generating the extra "_" if you ml.exe /c and do a notepad (whatever).obj them?


Vortex

Hi alCoPaUL,

The cdecl and stdcall calling conventions ( 32-bit ) have a common point, they insert a leading underscore to the public symbols. It does not matter if you use old libraries and new ones.

NoCforMe

That's called "name decoration", correct?
Isn't that controllable through some command-line switches or statements in the source file?
Assembly language programming should be fun. That's why I do it.

Vortex

#3
Hi NoCforMe,

Exatly. That's the name decoration :

QuoteThis document contains details about data representation, function calling conventions, register usage conventions, name mangling schemes, etc. for many different C++ compilers and operating systems. Discusses compatibilities and incompatibilities between different C++ compilers. Includes information that is not covered by the official Application Binary Interface standards (ABI's).

https://www.agner.org/optimize/calling_conventions.pdf

QuoteIsn't that controllable through some command-line switches or statements in the source file?

Yes, depending on the command-line options of a specific tool, you can control the calling convention. Plus some options of the assembler.
https://www.agner.org/optimize/calling_conventions.pdf