it's been awhile since I've done any real C++ development, but I'm trying to
create a managed interface to some COM libraries that don't implement
IDispatch or come with type libraries, so that pretty much means C++.
I have a managed class, MainClass, and an unmanaged class EventSink, the
managed class needs to create an instance of EventSink and set
EventSink._owner = this;
the EventSink class needs to call methods on the _owner member.
I have the following which complies fine. if I change the gcroot declaration
to use the actual type of MainClass I get lots and lots of errors. How can
I resolve this?
MainClass.h
#include "EventSink.h"
[CLSCompliant(true)]
public ref class MainClass : public System::ComponentModel::Component {
//full implementation in header file
}
EventSink.h
#include <vcclr.h>
class EngineSink :
public CComObjectRoot,...
{
public:
// gcroot<MainClass^> _owner;
gcroot<System::Object^> _owner;
//full implementation in header file
}
Gary Chang[MSFT] - 21 May 2005 11:37 GMT
Hi Scott,
For the question about the new C++/CLI programming issue, I suggest post
it to our Visual Studio 2005 Forums / Visual C++ Language which you can get
many more help there:
http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=96
Thanks!
Best regards,
Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.
Gary Chang[MSFT] - 24 May 2005 09:01 GMT
Hi Scott,
>I have the following which complies fine. if I change the gcroot declaration
>to use the actual type of MainClass I get lots and lots of errors. How can
>I resolve this?
In order to let me better understand the question, could you please help
provide the following information:
Which type of the errors you got when wrapping the MainClass in the gcroot
template?
Do you have the same problem when you wrap a simple custom managed class in
the gcroot template?
Thanks!
Best regards,
Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.
Scott W - 25 May 2005 03:22 GMT
I've since gotten the solution to compile. I moved some of the
implementation code out of the header file and into the .cpp file, and then
added
ref class Parent; in the Child header file.
*sigh*
> Hi Scott,
>
[quoted text clipped - 28 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Gary Chang[MSFT] - 25 May 2005 07:24 GMT
It's OK, Scott, the gcroot should work alright in the VC2005 :)
Good Luck!
Best regards,
Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.