Using VC++ code in .NET

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DocR

    #1

    Using VC++ code in .NET

    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


  • Kuba Florczyk

    #2
    Re: Using VC++ code in .NET

    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" <Doc@hotmail.co m> napisa? w wiadomo?ci news:ezrYbehjDH A.2328@TK2MSFTN GP10.phx.gbl...
    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


    Comment

    Working...