By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,776 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

an MFC-DLL using a namespace declared in a C# application

P: n/a
hi

I have a C# application (test.cs) that looks as like:

using System;

namespace CM
{ public class CallbackHandler()
{
}

public void PrintAttention(string out)
{ // print out out
}
}

Now I want to call the function PrintAttention(string out) from within
a function in an MFC-DLL.
How can I adress the function PrintAttention(string out) from the
MFC-DLL (unmanaged code C++).
I tried

#using "test.cs"
using namespace CM;

void function_in_MFC_DLL()
{ Callbackhandler test = new CallbackHandler();
test.PrintAttention();
}

When I write this I get a compiler error C2871 CM: a namespace with
this name does not exist

Can someone please give me advise or tell me what I'm doing wrong??

Thx in advance

Mar 14 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
change the compile option to add managed code support, and add the C#
assembly to project references
<pi***********@gmail.com> ????
news:11*********************@p10g2000cwp.googlegro ups.com...
hi

I have a C# application (test.cs) that looks as like:

using System;

namespace CM
{ public class CallbackHandler()
{
}

public void PrintAttention(string out)
{ // print out out
}
}

Now I want to call the function PrintAttention(string out) from within
a function in an MFC-DLL.
How can I adress the function PrintAttention(string out) from the
MFC-DLL (unmanaged code C++).
I tried

#using "test.cs"
using namespace CM;

void function_in_MFC_DLL()
{ Callbackhandler test = new CallbackHandler();
test.PrintAttention();
}

When I write this I get a compiler error C2871 CM: a namespace with
this name does not exist

Can someone please give me advise or tell me what I'm doing wrong??

Thx in advance

Mar 14 '06 #2

P: n/a
your

#using "test.cs"

should be

#using "test.dll"

<pi***********@gmail.com> wrote in message
news:11*********************@p10g2000cwp.googlegro ups.com...
hi

I have a C# application (test.cs) that looks as like:

using System;

namespace CM
{ public class CallbackHandler()
{
}

public void PrintAttention(string out)
{ // print out out
}
}

Now I want to call the function PrintAttention(string out) from within
a function in an MFC-DLL.
How can I adress the function PrintAttention(string out) from the
MFC-DLL (unmanaged code C++).
I tried

#using "test.cs"
using namespace CM;

void function_in_MFC_DLL()
{ Callbackhandler test = new CallbackHandler();
test.PrintAttention();
}

When I write this I get a compiler error C2871 CM: a namespace with
this name does not exist

Can someone please give me advise or tell me what I'm doing wrong??

Thx in advance

Mar 14 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.