I am working on a project that includes multiple DLLs, all with the source code. Code is in C++ with some .Net and C# (external source code that's a black box to me) and using VS2010. Yesterday, I compiled the project, but at startup the application exits (in release) or fails an assertion (debug). The failed assertion is
msvcr100d.dll!_msize_dbg(void * pUserData, int nBlockUse) Line 1516 + 0x30 bytes C++
/*
* If this ASSERT fails, a bad pointer has been passed in. It may be
* totally bogus, or it may have been allocated from another heap.
* The pointer MUST come from the 'local' heap.
*/
_ASSERTE(_CrtIsValidHeapPointer(pUserData));
I found several similar questions on SO (e.g. this and this) which led me to confirm that all projects are compiled with the /MD and /MDd flags. I placed a breakpoint at the first line of main()
, but never reached it.
The full call stack is
msvcr100d.dll!_msize_dbg(void * pUserData, int nBlockUse) Line 1516 + 0x30 bytes C++ msvcr100d.dll!_dllonexit_nolock(int (void)* func, void (void)* * * pbegin, void (void)* * * pend) Line 291 + 0xd bytes C msvcr100d.dll!__dllonexit(int (void)* func, void (void)* * * pbegin, void (void)* * * pend) Line 269 + 0x11 bytes C DPlus.exe!_onexit(int (void)* func) Line 110 + 0x18 bytes C DPlus.exe!atexit(void (void)* func) Line 127 + 0x9 bytes C DPlus.exe!std::`dynamic initializer for '_Fac_tidy_reg''() Line 49 + 0xf bytes C++ [Managed to Native Transition]
DPlus.exe!_initterm(void** pfbegin, void pfend) Line 132 C++ DPlus.exe!::LanguageSupport::InitializeNative() Line 376 C++ DPlus.exe!::LanguageSupport::_Initialize() Line 491 C++ DPlus.exe!::LanguageSupport::Initialize() Line 698 C++ DPlus.exe!?.cctor@@$$FYMXXZ() Line 749 + 0x9 bytes C++ mscoreei.dll!7450f5a3()
[Frames below may be incorrect and/or missing, no symbols loaded for mscoreei.dll]
mscoree.dll!74587f16()
mscoree.dll!74584de3()
kernel32.dll!7559336a()
ntdll.dll!77219f72()
ntdll.dll!77219f45()
In the call stack, the first item has a variable that gives a little more information. In DPlus.exe!?.cctor@@$$FYMXXZ() Line 749 + 0x9 bytes C++
in the file mstartup.cpp, the line 748 LanguageSupport languageSupport;
languageSupport.ErrorMessage has the value of "The C++ module failed to load during native initialization."
That led me to more links (SO: 1, 2; MSDN: 1) that didn't shed any light for me.
The weirdest thing, is I did a clean checkout of previous revisions that did compile and run, but no longer do. This happens both on my desktop (Win7) and laptop (Win8).
Any hints on where to start (continue) looking?
Thanks.
=========== Update ===========
I was able to localize the issue. There is an included template class (not in a DLL) that works when included in one project (C++, CL and DLL), but doesn't when included in the GUI (C++, .Net). If I remove the #include
and insert a dummy class that doesn't do anything, the project runs (sans a little functionality provided by said class). Now I'm really confused.
=========== Update ===========
The included libraries in the template class are:
#pragma once
#include <vector>
#include <string>
#include "Eigen\Core"
#include "Common.h"
#include <sstream>
#include <Eigen/Eigenvalues>
#include <Eigen/Geometry>
#include "boost/filesystem.hpp"
#include "boost/filesystem/fstream.hpp"
#include <boost/algorithm/string/predicate.hpp>
#include <iostream>