When I want to create a .dll-File in Visual Studio (c++) I use the following code in the Header-File:
#ifdef MYPROJDLL_EXPORTS
#define MYPROJDLL_API __declspec(dllexport)
#else
#define MYPROJDLL_API __declspec(dllimport)
#endif
I use "MYPROJDLL_API" as a macro to mark functions of the class that have to be exported. Visual Studio creates the definition of "MYPROJDLL_EXPORTS" automatically in the project settings. I ask myself why I have to create an if-statement because "MYPROJDLL_EXPORTS" is defined by Visual Studio on build by itself, so that the else-branch is never triggered on building.