You can wrap your old C ++ code in a C ++ / CLI shell and create it in a DLL file. Then it should be visible in any .NET project.
This may change slightly depending on your algorithm / function structure, but the main form and the way I did it are as follows. Keep in mind that this is a VERY simple example, but I tried to include key points:
1. CLI shell definition
using namespace System; #include "myAlgorithmClass" public ref class MyCLIWrapperClass
2. Introduce a shell class
using namespace System;
After you write a shell class and compile it into a class library, you can create a link to the .DLL file in a C # project, and C # should see the managed shell class and all its public functions.
One more note: if you create new managed objects in C ++, instead of "new" you use the keyword "gcnew". So the new line will be String ^ someString = gcnew String();
Finally, here are some links to some things about the CLI that may help:
CLI - Wikipedia
CLI - Draft Code
CLI - FunctionX
source share