Ben Voigt [C++ MVP] wrote:
mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already
defined in MSVCRT.lib(dllmain.obj)
I think this indicates that not all your source files are using the
same runtime library settings (i.e. /MT and whatever the equivalent
is for "Use MFC in a Shared Library").
I managed to make this link error go away by checking out the code
again from Subversion and compiling and linking everything from
scratch.
However, I still get the same crash in GcpsDotNetApi.dll!`dynamic
initializer for 'afxModuleState''() Line 66 + 0x14 bytes
It appears that this is caused by the use of the MFC library in the
.NET component GcpsDotNetApi.dll. I think the variable afxModuleState
is defined somewhere in the afx header files.
I read about initialization of mixed assemblies here:
http://msdn.microsoft.com/nb-no/ms173266(en-us).aspx
I think my problem might be some kind of "loader lock issue" , but I
have no idea how to fix it, since I did not declare the afxModuleState
variable myself, and hence I cannot put e.g. #pragma unmanaged on it.
unmanaged is already in effect for it. You may want to use #pragma