It seems like the OP got the whole process wrong.

The compiler uses the function prototype declared in header file, it choose the function using the prototype, not the mangled name in the lib file, in fact, the compiler doesn't even know about the lib file, that's the job of the linker.

say you have void fun(double); declared in you header, then you call fun(2), the compiler find the void fun(double) funtion, then it 'generates' the mangled name for it in the obj, then the linker will try to match the mangled name with some other mangled name in the lib file, if it can't find one, then you get a linker error, if happens when your header file doesn't match you lib file.