Using Visual C++ in C# project

Hi

I am a new bie so please forgive me if the question is not appropriate.

I am having a visual c++ project and i want to create a another project using C#. However i want to use some of the function that already in the C++ project. What is the best way i can do in this situation

The project is not really suitable for convert to DLL. Is there any good tutorial of how to convert C++ to DLL or C#

Thanks a lot for your help
I do appreciate that

Best regard

Maverick



Answer this question

Using Visual C++ in C# project

  • Alx_it

    "Native", as in the source code is compiled to a binary that can only be run on a specific, or compatible processor (Intel for example). With most managed languages compilation of source code results in assembly to a intermediate language. That binary would then be deployed and be compiled for the host processor as needed--often just-in-time (or JIT).

    If you're using Visual C++ and you're not targeting .NET then you're creating native binaries. Often people will refer to this as "unmanaged".

    I don't get an 500 error with that link. 500 is a general server error, which could be the result of many different things--likely something very temporary.



  • KennyABC

    If your existing C++ project is native you can use Implicit PInvoke (or C++ interop) to wrap the native code with a managed wrappers. The project will have to in a form that can either be a DLL or a LIB.

    See http://msdn2.microsoft.com/en-US/library/2x8kf7zx(VS.80).aspx for documentation on how to use Implict PInvoke.

  • MikeLR

    Hi

    Thanks a lot for your answer.
    Can you please tell me what is mean by "native code"
    I am quite new to Visual C++ so please forgive me if the question is not appropriate.

    One more thing, when i click at the link it show error 500. Is there anywhere that i can find something like that

    Best regard
    Maverick



  • Using Visual C++ in C# project