Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2005

Tip: Looking for answers? Try searching our database.

how do I organize my C++/CLI solution

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Scott W - 20 May 2005 15:52 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.