Search code examples
c++visual-studiodlldllimportdllexport

Nested DLL include configuration in Visual Studio


I have a Visual Studio Solution containing several projects:

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

Here a schema : enter image description here

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:

enter image description here

Lib Conf:

enter image description here

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 ?


Solution

  • 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