That was entirely what Cornedbee was saying: Unless the LTO also understands what happens in every shared library/DLL that is used in conjunction with the application code, it can not know if a function is used as an external call from a shared library.
For example, I could write some code in a shared library that does this:
Code:
extern void ErrorHandler(int errorcode);
void Error(int errorcode)
{
CleanUp();
ErrorHandler(errorcode);
}
then expect the main application to supply an ErrorHandler function that does something meaningfull to the applicaton.
I admit this is not a COMMON scenario, but it's certainly possible - and the compiler can't assume (at least not without special options supplied) that this MUSTN'T happen.
In fact I have seen code similar to that in RTOS implementations, where the user-supplied side is SUPPOSED to supply certain functions with certain names and arguments, or the system will not work.
--
Mats