嵌套的DLL包括Visual Studio中的配置(Nested DLL include configuration in Visual Studio)

编程入门 行业动态 更新时间:2024-10-18 03:24:18
嵌套的DLL包括Visual Studio中的配置(Nested DLL include configuration in Visual Studio)

我有一个包含多个项目的Visual Studio 解决方案

UtilsDLL RendererEngineDLL PhysicsEngineDLL GameProjectEXE

这里有一个模式:

渲染器和物理DLL包含Utils DLL。 除非我决定创建此GameProject(Visual Studio中的控制台应用程序项目),否则关于Visual Studio配置的一切都不是问题。 GameProject将从Renderer和Physics引擎中创建导出类的实例。

如果我想让我的GameProject 链接没有问题, 我需要包含我的Utils DLL项目的include文件夹.lib 。 我不明白为什么。

这里的VS配置截图:

包含Conf:

Lib Conf:

是否正常,我必须在GameProject的Visual Studio配置中包含嵌套的DLL? 有没有人有类似的问题?

I have a Visual Studio Solution containing several projects:

Utils : DLL RendererEngine : DLL PhysicsEngine : DLL GameProject : EXE

Here a schema :

The Renderer and Physics DLLs include the Utils DLL. Everything about the Visual Studio configuration wasn't a problem until I decide to create this GameProject (A Console Application project from Visual Studio). GameProject is going to make instance of exported classes from the Renderer and Physics engines.

If I want to make my GameProject link without a problem I need to include the include folder and .lib of my Utils DLL project. And I don't understand why.

Here the VS configuration screenshots :

Include Conf:

Lib Conf:

Is it normal that I have to make an include of a nested DLL in the Visual Studio configuration of the GameProject ? Does anyone had similar problem ?

最满意答案

如果你的程序(.exe)只使用由dll的接口声明和/或定义的东西,那么程序构建不需要知道这些dll在其实现中使用的任何东西。

但是,如果您的utils-project中的任何内容在dll的接口标题中都可见,并且您在程序代码中使用该标题,那么您的程序依赖于utils.dll。 现在你需要通知你的构建环境在哪里找东西。

具体来说:

如果您需要包含构建的utils目录,那么utils-project中的头文件将包含一个或多个 Renderer-和/或PhysicsEngine的头文件。

如果您需要为您的构建包含utils的lib文件,则会调用utils.dll 一个或多个导出函数(或导出类的方法)

解决方案:清理你的dll的接口头文件

if your program (.exe) ONLY use stuff declared and/or defined by the interfaces of the dll's then there is no need for your program-build to be aware of anything that those dll's are using in their implementations.

However if anything from your utils-project is made visible in an interface-header of either dll and you use that in your program code ,then you have a depedency from your program to the utils.dll. Now you need to inform your build environment where to find stuff.

to be concrete:

if you need to include the directory of utils for your build ,then there is a include for a header-file from the utils-project in one or more of the headers of Renderer- and/or PhysicsEngine.

if you need to include the lib-file of utils for your build ,then there is call to one or more exported functions (or methods of an exported class) of the utils.dll

Solution : sanitize the interface-header files of your dll's

更多推荐

本文发布于:2023-07-14 18:55:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1106670.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:嵌套   Visual   DLL   Studio   include

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!