Saturday, November 26, 2005

Peculiar compiler warnings

Have you by any chance tried to compile some C++ project consisting of mixed code assemblies with the new Visual Studio 2005 (in my case a couple of managed assemblies, couple of unmanaged ones and ATL and MFC on top)?
I have and I must admit that the new diagnostics embedded *inside* generated assembly did surprise me a bit (although must say in a good way). The thing is if you use ATL inside *any* of your assemblies, you should declare _ATL_MIXED preprocessor constant inside each and every project you have in your solution. This is somewhat vaguely described inside MSDN that comes with VS 2005. It is also stated that this makes all entry points native (I presume that it has something to do with the loader lock problem from the previous VS versions). Only if you somehow forget to declare _ATL_MIXED const in one of your projects, will you get a compiler warning and you’ll also get a little surprise inside your target assembly.
Here’s the screenshot that says a thousand words…



[This entry comes courtesy of my colleague Orest Kulik who has been living together with managed C++ for the last four years and who can’t wait to put his hands on C++/CLI. Thanks, Orest.]

0 Comments:

Post a Comment

<< Home