Using VC++ code in .NET

D

DocR

I have some VC++ tested code that I want to use from C#.NET. I know I have methods to port the code from VC++ code to .NET but my code is tested and I do not want to port that to C#.NET. Then I know that .NET can use the unmanaged code, I think I have options to make the dll of the code I have and then call the functions from my .NET code. But I am confused how can I do that because I could not find a good tutorial on that.

I am sure lots of people may be are doing the same thing either by P/Invoke or some other method. I assume that P/Invoke is the best method if someone has no control over the dll. But as I have the unmanaged code and I can build that the way I want, please suggest that which kind of dll should I make (COM dll or standard dll) so that I can call the functions from that dll in .NET without much coding.

If someone has some suggestions on how to use my VC++ code in .NET. please suggest.

Thanks

Doc
 
K

Kuba Florczyk

Hi

I write standard DLL (win 32 for example) and next i wrote a wrapper class for this library. I think that is the best way :) In msdn is a few examples of wrappers for c++.

kuba florczyk
U?ytkownik "DocR" <[email protected]> napisa? w wiadomo?ci I have some VC++ tested code that I want to use from C#.NET. I know I have methods to port the code from VC++ code to .NET but my code is tested and I do not want to port that to C#.NET. Then I know that .NET can use the unmanaged code, I think I have options to make the dll of the code I have and then call the functions from my .NET code. But I am confused how can I do that because I could not find a good tutorial on that.

I am sure lots of people may be are doing the same thing either by P/Invoke or some other method. I assume that P/Invoke is the best method if someone has no control over the dll. But as I have the unmanaged code and I can build that the way I want, please suggest that which kind of dll should I make (COM dll or standard dll) so that I can call the functions from that dll in .NET without much coding.

If someone has some suggestions on how to use my VC++ code in .NET. please suggest.

Thanks

Doc
 

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