Third-party Crashes
Twice in the last three weeks I’ve had software I’m developing crash badly before main() even gets control. Though completely separate situations, each had to do with a third-party package.
Fortunately we were able to work through each in reasonably short order, still using the package without the problem.
One was a proprietary package, and the vendor was willing (and able) to work with us. I wound up iterating to the problem’s source: an issue between Microsoft’s managed and non-managed C++. When this package included Microsoft’s ATLComTime.h, my managed C++/CLI app wouldn’t start. Otherwise it would. (Visual Studio’s “Use of ATL” and “Minimize CRT Use in ATL” had no effect.) We worked around it.
The other package was boost’s serialization. Using the same templated serialize() function in two different compilation modules under CygWin would cause a SIGSEGV on startup. Gdb showed the problem to be in
boost::serialization::extended_type_info::extended_type_info ()
The production environment (FreeBSD) worked fine, but the convenience of CygWin drove me to look for a solution. Here it is:
BOOST_CLASS_TYPE_INFO(MyClass, extended_type_info_no_rtti
)
This solution should work on all platforms. Very disconcerting when something crashes even before main() starts, and more so when it’s a third-party package. Common components are necessary and worth this trouble, but I expect more of it as time marches on.