How can I do that?
Would it work if I added the C++ code to the current C# project/colution? Do
I have to create another assembly with a managed C++ wrapper to the old C++
code?
Thanks!
Shakir Hussain - 29 Jun 2004 15:22 GMT
Daniel,
One way to use ur old c++ code is to compile as a dll. In c#, you can access
the functions using "DllImport".
Unsafe c# is another way to use c++ code. Refer MSDN regarding that.
--
Shak
(Houston)
> How can I do that?
>
[quoted text clipped - 3 lines]
>
> Thanks!
Bill Burris - 29 Jun 2004 18:56 GMT
I used a managed C++ wrapper for my old C++ code.
In your solution add a managed C++ library. Add your existing C++
source to the project and compile. Once everything compiles, add
managed C++ classes to create the API that you want your C# code to see.
After doing this you will likely get a LNK 4243 warning. Search for
this warning in your local MSDN docs or the MSDN website to find out how
to initialize the C run time library.
If you don't already know managed C++ you might want to use a Beta
version of VS 2005, or wait until it is released. From what I here the
managed C++ syntax will change in VS 2005.
Another posibility is to use the Unix way. Set up your C++ code as a
separate process. Use sockets to communicate between the program
written in C++ and the one written in C#. I was just reading "The Art
of Unix Programming" on the weekend, so havn't tried this technique yet.
Bill