How to create some class from dll(constructor in dll)?(?++)-Collection of common programming errors

You need to declare your class using the __declspec(dllexport) keyword when building the DLL. When using the DLL, the class needs to be declared with __declspec(dllimport):

#ifdef COMPILING_DLL
#define DECLSPEC_CLASS __declspec(dllexport)
#else
#define DECLSPEC_CLASS __declspec(dllimport)
#endif

class DECLSPEC_CLASS MyClass
{
...
}

When the DLL is compiled, you should add -DCOMPILING_DLL to the list of defines.

When using the class, you must statically link with the DLL, i.e. pass the import library mydll.lib to the main program.

If you want to load the DLL at runtime, you need to have a C-function in the DLL which creates a object and returns it for you. There is no way to lookup a constructor dynamically in a DLL (using GetProcAddress()).