创建包含所有依赖项的独立DLL

Creating a standalone DLL that contains all dependencies

本文关键字:独立 DLL 依赖 包含所 创建      更新时间:2023-10-16

我正在VS9中的c++项目中工作,该项目引用了许多头文件,.dll和.lib文件。

我想将其作为包含所有依赖项的独立DLL输出,以便我可以使用LoadLibrary()将其拉入。

这是可能的吗?如果是,我如何在VS9中做到这一点?

我已经创建了DLL,但是通过depends.exe运行它会给我错误:

Error: At least one required implicit or forwarded dependency was not found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

谢谢

如果其他dll恰好是CRT,使用/MT编译将消除依赖关系。如果您正在处理其他dll,则可以将它们作为资源嵌入,然后在运行时加载它们。我自己从来没有这样做过,但你可以通过阅读:

    在Win32可执行文件中嵌入DLL和二进制文件
  • 从内存中的某个位置加载DLL