开发者

Is compiler able to do a procedural integration of functions imported from dll?

开发者 https://www.devze.com 2022-12-30 04:44 出处:网络
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开发者_

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消