From: Jochen Kalmbach [MVP] on 5 Aug 2008 12:48 Hi �ystein! > Do you have any further ideas on what might be wrong? Do you know of any > support e-mail addresses or newsgroups that would put me in direct > contact with people from the Visual C++ team in Microsoft regarding this > problem? Contact MS product support. They can help you! -- Greetings Jochen My blog about Win32 and .NET http://blog.kalmbachnet.de/
From: Ben Voigt [C++ MVP] on 6 Aug 2008 10:45
�ystein Skotheim wrote: > Ben Voigt [C++ MVP] wrote: > >>> mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain(a)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. If you're linking with a library compiled without /clr, then #pragma unmanaged is already in effect for it. You may want to use #pragma managed(push, off) and #pragma managed(pop) around your #include for the MFC header files to make sure they match. > > I have been trying for many days now to solve the problem but still no > success. I found this Microsoft article describing a somewhat similar > problem: > http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99715 > > I have tried to replace the main subroutine with > CWinApp::InitInstance() in my main application and changing the entry > point from main to WinMainCRTStartup but I still get the same crash. > (I guess I would have to change something in GcpsDotNetApi.dll and > not in my main application to get rid of this problem). > > Do you have any further ideas on what might be wrong? Do you know of > any support e-mail addresses or newsgroups that would put me in direct > contact with people from the Visual C++ team in Microsoft regarding > this problem? > > Regards, |