Friday, March 5, 2010

when exporting C++ (template) objects is *not* a good idea

Most of the time, compilers are your enemies because they will do almost anything they can to compile your warm steaming pile of code into a binary image. Clearly the author of this code was having troubles and thought it best to warn others of his insanity. Apparently the correct solution of never export C++ objects out of a DLL was not an option?

// We disable this warning (4251) for the entire project because
// our code is exporting objects that contain stl templates.
// It seems to be the general idea on the internet to simply disable this warning
// since it is hard to eliminate it.

#pragma warning( disable : 4251)

No comments: