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 / .NET Framework / Interop / November 2004

Tip: Looking for answers? Try searching our database.

Problem referencing Managed class from the Unmanaged (beginner question)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sasha Nikolic - 25 Nov 2004 13:38 GMT
I have a managed ( __gc ) class and a unmanaged ( __nogc ) class in the same
VC++ 2003 project (since I need to create a dotnet wrapper for some old c
library code). I can easily reference unmanaged class from the managed one,
but I'm having problems when I need to call managed class method from the
unmanaged class.

I have tried gcroot but I got into problems:

- When I just tried placing something like
gcroot<ManagedClass*> m_pManagedClass;
I got error C2065: 'ManagedClass' : undeclared identifier.

- OK, unmanaged class was missing definition of the managed one so I added
one include in the unmanaged class header file :
#include ".\ManagedClass.h"
This gave some syntax errors in the ManagedClass.h (which was compiling OK
before).

Does anybody have some ideas how can I reference the managed class from the
unmanaged? I just need to call one method.

Is there a better way of doing this.

Thanks a lot,
Sasha
Sasha Nikolic - 25 Nov 2004 14:59 GMT
From the UnmanagedClass.cpp file I can easily use System::* namespaces and
implement those objects but if I specify:

using namespace ManagedNamespace;

I get the error:

error C2871: 'ManagedNamespace' : a namespace with this name does not exist

Any help appreciated!

Cheers,
Sasha

> I have a managed ( __gc ) class and a unmanaged ( __nogc ) class in the same
> VC++ 2003 project (since I need to create a dotnet wrapper for some old c
[quoted text clipped - 21 lines]
> Thanks a lot,
> Sasha

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.