Mixed-Mode Programming Issues
As with any new development environment, there are some caveats that you should be aware of when mixing managed and unmanaged code. In this part, we examine a few of the most common problems encountered by those new to mixed-mode programming:
Avoiding inadvertent #define side-effects
Allocating reference objects in MFC debug builds
Using string literals and converting strings
Avoiding Inadvertent #define Side Effects
One of the first issues you're sure to run into is the problem caused when you attempt to use a function, operator, or type that has been #define'd to a different value than you expect. One example of that is in attempting to use the MessageBox::Show method:
using namespace System; ... // Display a message ...
Get Extending MFC Applications with the .NET Framework now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.