how do I organize my C++/CLI solution

S

Scott W

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
}
 
G

Gary Chang[MSFT]

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.
 
G

Gary Chang[MSFT]

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.
 
S

Scott W

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*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top