A long time ago, a wide discussion of language emerged in the blog Park. In fact, language disputes have never stopped in the entire programmer circle. In my opinion, language is just a tool. When you need to write the underlying layer, you can use C ++. When you need to write dazzling desktop applications, you can use C # WPF, when you need web development for large websites, you can select JAVA. Of course there are many other languages. This is just a choice for different projects. each language has a stage that it is good at, and what remains unchanged for years is data structures and algorithms. The words of the family are light. Below is the question: the obstacle to crossing the language: C ++ calls C # DLL when C # projects need to reference C ++ dll, you can directly use DLLIMPORT for calling. In reverse mode, C ++ projects cannot simply reference C # DLL. The default configuration of the C ++ project is not supported by the public Language Runtime Library. Therefore, we need to modify some configurations to call C # dll. C ++/cli to call c # dll: [Thank you for adding me: this example is only used by developers for research, c ++ clr conflicts with some c ++ compilation options, and does not support some mfc external link sources.] First, complete C # dll development: copy the code namespace Csharp {public class Class1 {public string Name = string. Empty; public Class1 () {Name = "We can use C #!! ";}}} Copy the code and compile it to obtain the Csharp dll. Next, configure the C ++ project attributes: add the common language runtime support/clr (c ++/cli). Next, add a new reference and select the Csharp compiled in step 1. # using and using namespace must be used in the dll code to call the dll. When allocating memory, pay attention to using gcnew. gc is required to allocate memory to it. The hosted object must be declared using ^. Copy the Code # include "stdafx. h "# using" Csharp. dll "using namespace Csharp; int _ tmain (int argc, _ TCHAR * argv []) {Class1 ^ a = gcnew Class1 (); printf (" % s/n ", a-> Name); return 0 ;}