I know, that modern compilers can do procedural integration not only with functions defined inline, but also with functions residing in object files. But is this also true when you compile your开发者_开发知识库 program against shared library (especially dll)? Roughly speaking: will function code be copied into executable from dll, if that's desirable?
No, because the compiler does not have the code that makes up those functions.
On Windows, when you link against a dynamic library, you usually include a header and link against an import library, which simply contains the code to load the dynamic library and obtain pointers to the functions that you call (technically, you don't need the import library; you can also manually call LoadLibrary()
and friends).
Since the compiler never sees the code in the dynamic library itself, it certainly can't perform inline expansion on the code.
精彩评论