问题
When you dump the external symbols of a library, you may find there are multiple versions of the same function name; such as the case with printf
function from the C library, you will find names like
__imp__printf
_printf
___imp___printf_l
Why there is no just one version of the function?
When I tried to see which OBJ member in the library they are belong to, I found that they all belong to the same OBJ file (an import library) that have only one version, which is _printf
, and this is the only PROC
name among all these versions, and the rest of them are "DATA".
The library is MSVCRTD.lib and the library member is MSVCR100D.dll, the platform is Microsoft Windows 7 and Visual C++.
Can anyone explain this to me?
EDIT: adding most of the "printf's" in the msvcrtd.lib library my eye could catch, and actually there is more.
some of them belong to the same OBJ member in the library( according to it's offset number in the pictures), and some are not . I need to understand why all of these versions of printf's exist in the c library ? are they exist to support several compilers(with several mangling) that might call the printf function? because when I called printf from MASM it decorated it to be _printf
and when I called it from C compiler , it decorated it to be __imp__printf
, so I guessed these multiple versions might exist to support different compilers that might use the library, Is that correct or not?
please I need to understand the linkers and how they work , and an answer to this question will help me a lot. for us there is only one printf that is we call all the time, why the linker needs all of these?



















来源:https://stackoverflow.com/questions/30245535/multiple-decorated-mangled-versions-from-the-same-function-in-a-single-library