Using C++ code in a C# project.
I have a curve fitting algorithm in templated C++ and I want to use it in my C# project.
I need to figure out what I need to do to use this code without translating it into C#.
I'm told I could make a component out of it, but I don't know how.
I was told something about 'unsafe' code... don't know how...
Help?
Re: Using C++ code in a C# project.
Create a DLL project in C++ that contains your method(s).
Use DLLImport to call your methods from your C# code.
Example here:
http://www.codeguru.com/csharp/cshar...cle.php/c4217/
Re: Using C++ code in a C# project.
Ok thats a good starting point.
I need to pass an array of floats to the dll and I'm really not sure what C# is passing and what C++ is receiving...
Re: Using C++ code in a C# project.
If the algorithm really complicated? If not, why not just re-write it in C#?