<p>Recently, I've been dealing with an error with accessing MAPI via the .NET framework (as described in <a href="http://blogs.msdn.com/mstehle/archive/2007/10/03/fyi-why-are-mapi-and-cdo-1-21-not-supported-in-managed-net-code.aspx" rel="nofollow noreferrer">this article</a>). I am now left with a series of memory access violation errors.</p>

<p>To get past the issues, I have been trying to use <a href="http://www.codeproject.com/KB/IP/CMapiEx.aspx" rel="nofollow noreferrer">this 3rd party component</a>, which has a Visual C++ core. Unfortunately - we are still having the same errors.</p>

<p>I've personally never used Visual C++, but my question is: if the C++ library is compiled using Visual Studio 2005, using Visual C++ - does the memory of the project become managed by the .NET framework, as well, which would therefore make it subject to the same issues as the .NET libraries we're using? Or am I barking up the wrong tree?</p>

[{'answer_id': 19676, 'author': 'samjudson', 'author_id': 1908, 'author_profile': 'https://Stackoverflow.com/users/1908', 'pm_score': 0, 'selected': False, 'text': "<p>Unless you are using Managed C++ (which it doesn't sound like you are) then no, the memory is not managed by the CLR.</p>\n\n<p>The recommended method of talking to Exchange in .Net is via WebDAV.</p>\n"}, {'answer_id': 19678, 'author': 'olliej', 'author_id': 784, 'author_profile': 'https://Stackoverflow.com/users/784', 'pm_score': 1, 'selected': True, 'text': "<p>I'm not entirely sure what you're asking, but i'll give it a shot.</p>\n\n<p>Visual C++ is a pure C/C++ compiler so has none of .NET's memory management, nor any of its runtime -- You have to manually call new and delete.</p>\n\n<p>.NET also provides C++/CLI, which is a slightly modified version of C++ that targets the .NET runtime, and is GC aware -- eg. its memory is managed by the .NET runtime.</p>\n\n<p>Without more details about your bug I can't really make any suggestions, beyond suggesting that you make sure you use the appropriate GC guards, and the provide finalizers in any place they are needed.</p>\n"}, {'answer_id': 19754, 'author': 'Mark Ingram', 'author_id': 986, 'author_profile': 'https://Stackoverflow.com/users/986', 'pm_score': 1, 'selected': False, 'text': '<p>The two previous answers have mentioned "Managed C++", this is an old bolt-on that they did to allow you to use managed C++ in a .NET environment. It wasn\'t a first class citizen - unlike C++/CLI (<a href="http://en.wikipedia.org/wiki/C%2B%2B_clr" rel="nofollow noreferrer" title="C++/CLI @ Wikipedia">link text</a>. But to answer your original question, no, Visual C++ is not managed by the .NET runtime. Managed C++ &amp; C++/CLI are.</p>\n'}]
['https://Stackoverflow.com/questions/19653', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/33/']