'.dll vs .dll with exports, what's the difference?

On Visual Studio 2019 create new project shows the following:

  • Dynamic-Link Library (DLL)
  • Dynamic-Link Library with exports (DLL)

Before I though we have static libraries and dynamic libraries.

enter image description here

So what's the difference?

Do we also have this kind of options while using cmake?



Solution 1:[1]

Maybe this helps: https://edwardhalferty.com/2020/08/29/difference-between-dynamic-link-library-with-exports-and-dynamic-link-library-in-visual-studio/

Extracting the essential info:

The major difference between them is, “with exports” adds some defines:

#define DLL1_API __declspec(dllexport)
#define DLL1_API __declspec(dllimport)

And it adds some example exports, so you can see how they work:

// This is an example of an exported variable
DLL1_API int nDll1=0;

// This is an example of an exported function.
DLL1_API int fnDll1(void)
{
    return 0;
}

// This is the constructor of a class that has been exported.
CDll1::CDll1()
{
    return;
}

In theory, you can compile this DLL and test it out immediately.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 codeling