Hi C++ experts ,

actually my knowledge is not very good I can call my self degree 2 beginner ,
But I know how to do things in C#, and write now I need to execute what I have already done in C#, in a c++ code.
MORE EXPLANATION : I need my c++ (native code ) to perform some actions that I already have a c# code that perform it,
is there a way to use my already code in C# to be executed in C++ , (the C++ code is to be dll file, so I think that saving C# as dll is not helping , is it?), I read somewhere in the net that there is a way but I could not get it ,

I hope I made my self clear
I really need urgent help in this
Thanks for who took time and read, double for how is going to answer.

Recommended Answers

All 7 Replies

> I need my c++ (native code ) to perform some actions that I already have a c# code that perform it
You do it the same way you call managed code from VB6: Make sure the C# code has a COM callable wrapper and use COM from native C++ to access the C# code through the COM interface. Edward can't offer much in the way of details though, due to lack of experience in that area. Ed's written managed DLLs for a COM driver, but not the other way around. :(

Thanks all for replying,
mitrmkar, the link is (what i need) 's opposite , it discusses, as I understood, linking c++ in C# but what i want is to link C# to native C++,
dll in native c++ caused me problems , any advices, please !

Thanks for help!

A MSDN article
How to call a managed DLL from native Visual C++ code in Visual Studio.NET or in Visual Studio 2005
http://support.microsoft.com/kb/828736
It assumes that you have a managed DLL + a native application. (Hopefully this one is of more use than the previous one.)

It assumes that you have a managed DLL + a native application. (Hopefully this one is of more use than the previous one.)

yes it helps and yes it is almost that way ,
but in addition the native code is supposed to be dll too, is it ok to call dll inside a dll?

Thanks again :)

the native code is supposed to be dll too, is it ok to call dll inside a dll?

Yes it is.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.