473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem referencing Managed class from the Unmanaged one

I have defined a managed class ( __gc ) and a unmanaged ( __nogc ) in a
separate files (but in the same vc++ dotnet project). I have no problem of
referencing the unmanaged class from the menaged one. My problem is that I
cannot reference managed class from the unmanaged.

In my unmanaged class, if I use "using namespace ManagedNamespace;" I get
error C2871: a namespace with this name does not exist. I get the simmilar
error when trying to reference the Managed class directly from the unmanaged
class methods.

If i use "#include ".\ManagedClass.h" I get syntax errors in that header
file (and it was compiling OK before referencing it from the unmanaged
class).

When I copy the unmanaged class to the same file where the managed is,
everything seems ok. Unfortunately, I must keep them separate.

Can anybody help?

Thanks,
Sasha
Nov 17 '05 #1
1 1450
A small repro case would be the fastest way to get a concrete solution to
this.

Thanks.

Ronald Laeremans
Visual C++ team

"Sasha Nikolic" <sa***@dmdsecure.com> wrote in message
news:OD**************@TK2MSFTNGP09.phx.gbl...
I have defined a managed class ( __gc ) and a unmanaged ( __nogc ) in a
separate files (but in the same vc++ dotnet project). I have no problem of
referencing the unmanaged class from the menaged one. My problem is that I
cannot reference managed class from the unmanaged.

In my unmanaged class, if I use "using namespace ManagedNamespace;" I get
error C2871: a namespace with this name does not exist. I get the simmilar
error when trying to reference the Managed class directly from the
unmanaged
class methods.

If i use "#include ".\ManagedClass.h" I get syntax errors in that header
file (and it was compiling OK before referencing it from the unmanaged
class).

When I copy the unmanaged class to the same file where the managed is,
everything seems ok. Unfortunately, I must keep them separate.

Can anybody help?

Thanks,
Sasha

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
5
by: Chris Kiechel | last post by:
I am writing a .NET Windows application and it needs to perform DDE calls to a legacy system. I created a C++ unmanaged class that performs the actual DDE connection and communication. However,...
1
by: Adam Clauss | last post by:
I have an unmanaged C++ library that I need to use through C#. I created a Managed C++ class library and through it wrote a wrapper class to call what I need. However, one of the methods (an...
8
by: Nadav | last post by:
Hi, I am writing a performence critical application, this require me to stick to unmanaged C++ as performance is much better using unmanaged C++ ( about 33% better ), Still, I am trying to avoid...
4
by: | last post by:
I am stuck in a situation and I do believe that this should work, but it doesn't. I have a unmanaged dll, that uses MFC. This works great. Now I recompile the unmanaged dll so it contains...
3
by: zhphust | last post by:
I want to convert a object of a managed class to a unmanaged structure that has the same member with that managed class. Can anybody tell me how i can do it? Thanks in advance. -- zhphust...
5
by: Ney André de Mello Zunino | last post by:
Hello. I am developing a project in managed C++ for the first time. Things were going fine up until the point I had the need to mix managed and non-managed code. More specifically, what I am...
9
by: Amit Dedhia | last post by:
Hi All I have a VC++ 2005 MFC application with all classes defined as unmanaged classes. I want to write my application data in xml format. Since ADO.NET has buit in functions available for...
6
by: Bruce | last post by:
I need to fire an event from an unmanaged class. If I declare a pointer to the managed class within the unmanaged class I get a compile error " "cannot declare a managed 'm_pGps' in an unmanaged...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.