473,396 Members | 1,998 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,396 software developers and data experts.

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

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
2 1556
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: David Walker | last post by:
Hi I have a program which I need to interface with a webpage - the webpage will accept an input (probably a 'post' string from the program) and then will process it and needs to return a value. ...
7
MFC
by: Sepandar | last post by:
HI I want a tutorial about MFC that's in visual C++. And I would be happy if someone can help me for drawing simple shapes like circle and rectangle and ellipse with MFC! thx *-==-*
1
by: kizmet | last post by:
Ok - so I'm going through my teach yourself VC++ in 21 days book second time around for revision). I've got to day 2 (groan). The book says to put the following code in.... void...
14
by: SignOff | last post by:
HI, I'm using a MSVC++ 7.0 with MFC. Let'ssay I created a class derived from CStatic: class Card : CStatic { ...... }
5
by: Tarundeep Singh Kalra | last post by:
Hi, i am a VC++ developer (MFC) and i want to use .NET at its best. But all the samples , tuotorials etc are either in C# or VB.NET. I have certain doubts :- 1). Is Microsoft going to phase...
16
by: um | last post by:
What's the deadline for MFC ?
8
by: Ney André de Mello Zunino | last post by:
Hello. When it comes to Win32, Visual Studio .NET 2005 Express Edition Beta 2 only allows the creation of console-based applications. What if one wanted to create MFC-based applications and, at...
12
by: Rasika WIJAYARATNE | last post by:
I am new to VCPP and was wondering about the unmanaged part of it: 1. Does MFC include all the functions/functionality of the STL so it can be used standalone? 2. Is the MFC mainly used for...
2
by: James Walker | last post by:
I am an experienced c++ programmer and I have done most of my c++ programming with .net as console or directx programs. I want to learn windows programming and make quality applications going...
6
by: Arnshea | last post by:
(apologies for the crosspost) I'm working with an MFC based COM object. From C# I'd like to be able to call a method on the COM object that takes a string array and modifies the contents. Is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.