Using magaged C++ class in unmanaged class data member.
-
I am new to the Managed C++,I have created a namespace "N" with one "Cl" class in that name space. Now I want to use this "Cl" as a data memeber in a unmanaged C++ class. the syntax i have followed in Unmanaged c++ class header is as follows.. class Unmanged { public: Cl *m_Managed; }; The reported error is.. error C3265: cannot declare a managed 'm_Managed' in an unmanaged 'Unmanaged' Please help in solving this is very urget for my assignement.. Thanks.
-
I am new to the Managed C++,I have created a namespace "N" with one "Cl" class in that name space. Now I want to use this "Cl" as a data memeber in a unmanaged C++ class. the syntax i have followed in Unmanaged c++ class header is as follows.. class Unmanged { public: Cl *m_Managed; }; The reported error is.. error C3265: cannot declare a managed 'm_Managed' in an unmanaged 'Unmanaged' Please help in solving this is very urget for my assignement.. Thanks.
Are both of these classes in the same application? Is the unmanaged class a COM object? At any rate, when you transfer data to and from managed and unmanaged types or call functions again from managed to unmanaged, or from unmanaged to managed classes or objects, the Interop marshaler takes care of some operations (invisibly from the programmer's point of view). Generally, this involves some data transfer and the marshaler tries to convert defined types to their compatible types in the other domain. The marshaler, because it deals with so many different and disparate types has a well-designed behavior. User-defined types are the most difficult to deal with and sometimes it is necessary to write a custom marshaler to enable the Interop to work properly. There is lots of information over at the MSDN site. And, in all honesty, I am not that experienced in this area, but, it is common to experience problems with Interop. I have been reading: "NET and COM: The Complete Interoperability Guide", by Adam Nathan, and I would highly recommend it as a source of 'official' Interop intel. A simple suggestion, though: use the same types for your data in both managed and unmanaged classes, and re-write your functions so that they accept those data members, rather than the class.
-
I am new to the Managed C++,I have created a namespace "N" with one "Cl" class in that name space. Now I want to use this "Cl" as a data memeber in a unmanaged C++ class. the syntax i have followed in Unmanaged c++ class header is as follows.. class Unmanged { public: Cl *m_Managed; }; The reported error is.. error C3265: cannot declare a managed 'm_Managed' in an unmanaged 'Unmanaged' Please help in solving this is very urget for my assignement.. Thanks.
Google for
gcroot
.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.