using unmanaged namespace in managed code

R

RaKKeR

Hi,

I'm trying to wrap my unmanaged c++ code into a managed c++ wrapper.
The problem is VC .NET doesn't seem to find the namespaces defined in
my unmanaged code. Let's say I have a file "server.h" with a namespace
server. When I include this file in another file that will be compiled
as managed, the compiler gives me the following error:

C2871: 'server' : a namespace with this name does not exist

How can I use unmanaged namespaces in my managed code?

Thx in advance,

RaKKeR
 
T

Tamas Demjen

///// unmanaged.h
namespace Unmanaged
{

class A
{
};

}

// managed.h
#include "unmanaged.h"
namespace Managed
{

ref class B
{
Unmanaged::A* a;
};

}

You should be able to wrap unmanaged code into a managed class, and use
unmanaged namespaces too.

Tom
 

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