471,315 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

how to communicate between MC++ and C#

Hi

I have some legacy code written in C++ and I am trying to add a GUI (plus
some other functionalities) using C#.
Thus the problem that I am facing is to have C# and C++ live together. I am
thinking that the 2 worlds would communicate using a managedC++ layer.

So in C# I have some utilities functions that I would like to be able to use
from my managed C++ .
How can I call a C# function ( say void DisplayLogMessage(string message) )
from the managed C++ side?
What I need is the most efficient (performance and memory wise) approach.

Thanks.
Nuno.
Jan 4 '06 #1
1 1015
Hi,
"Nuno" <nu****@comcast.net> wrote in message
news:fp******************************@comcast.com. ..
Hi

I have some legacy code written in C++ and I am trying to add a GUI (plus
some other functionalities) using C#.
Thus the problem that I am facing is to have C# and C++ live together. I
am thinking that the 2 worlds would communicate using a managedC++ layer.


You can call unmanaged code from C# , if the C++ code is in a COM component
all you have to do is add a reference form the IDE and it will create all
the needed glue.
If the C++ is a win32 dll , then you will have to use P/Invoke it's easy
unless you have complex structures you need to pass back and forth.


--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jan 4 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Daniel Lidström | last post: by
1 post views Thread by Philip | last post: by
3 posts views Thread by Philip | last post: by
2 posts views Thread by Lev | last post: by
reply views Thread by Peter Insley via .NET 247 | last post: by
3 posts views Thread by Bruno LIVERNAIS | last post: by
1 post views Thread by A. Nonymous | last post: by
reply views Thread by rosydwin | last post: by

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.