2

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?

Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
KcFnMi
  • 5,516
  • 10
  • 62
  • 136

1 Answers1

2

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.

codeling
  • 11,056
  • 4
  • 42
  • 71