Using VC++ code in .NET

  • Thread starter Thread starter DocR
  • Start date Start date
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
 
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
 
Back
Top