Mixing legacy MFC code with Windows Forms (Part 2)
I know how to call unmanaged code from a managed class.
How to do the opposite?
This piece of code
returns the following error:
Error 1 error C3265: cannot declare a managed 'm_rigging' in an unmanaged 'MFCControls::DiagramContainer'
Hints:
http://www.ondotnet.com/pub/a/dotnet/2003/03/03/mcppp2.html?page=last
Solution:
Use gcroot
m_rigging can be used as a usual Rigging^ object. You reach the members using ->
How to do the opposite?
This piece of code
public class DiagramContainer
{ private: // Managed reference to some dataRigging^ m_rigging;
};
returns the following error:
Error 1 error C3265: cannot declare a managed 'm_rigging' in an unmanaged 'MFCControls::DiagramContainer'
Hints:
http://www.ondotnet.com/pub/a/dotnet/2003/03/03/mcppp2.html?page=last
Solution:
Use gcroot
public class DiagramContainer
{ private: // Managed reference to some data. gcroot makes it look like an unmanaged typegcroot<rigging^ > m_rigging;
};
m_rigging can be used as a usual Rigging^ object. You reach the members using ->
