Development Environment
Operating system: 64-bit Win 7
Visual studio:2012
. Net framework:4.5
This is accomplished by developing a DLL using C #, in the c++ Call the method in C # in the console program.
Development Steps
1: Create the C # Class Library project. Name is: cshartlibrary
2. Change the contents of the Class1.cs file (only the files that you have voluntarily generated)
The contents are as follows:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Using System.Threading.Tasks;
Namespace Cshartlibrary
{
public class Class1
{
public void HelloWorld ()
{
Console.WriteLine ("Hello World");
}
}
}
3. Compile-generated DLL file CShartLibrary.dll located in Cshartlibrary\bin\debug
4. Create a new C + + project. (Type: Win32 Project; name Cppproject)
5. Change project Properties
6. Put the above generated CShartLibrary.dll into the Cppproject\cppproject, with the CppProject.cpp folder
7. If you want CTRL + F5 to execute directly. Also put the CShartLibrary.dll into the Cppproject\x64\debug folder.
(Note: There is only one layer of Cppproject folder OH)
Calling C # programs using C + +