I have 3 projects in Visual Studio 15. The first (A) and second (B) - dynamic libraries, the third (D) - exe, which uses both libraries. The task is to link the first library statically.
The first problem I encountered is if I link to both D libraries - then the singletones that are in A, cease to be in a single copy and appear in 2 different copies in B and in D. I decided - removing the link from A, in D, because all export functions from A are now in B.
The second problem. In A there are constructions of the form:
In header:
struct A_CLASS SomeClass {
static const double someMember;
};
in cpp:
const double SomeClass::someMember = 14;
A_CLASS is
#ifdef ( _BUILDA )
#define A_CLASS __declspec( dllexport )
#else
#define A_CLASS __declspec( dllimport )
#endif
If I try to use SomeClass::someMember in D - I receive a link error LNK2019.
dumpbin shows that in B.lib and in B.dll there is a type construct ?someMember@SomeClass@@2NA
How to fix this error?