The relationship among header file, cpp file and dll file is as follows: header file declaration method, cpp implementation method and dll obtained after cpp compilation, so the header file describes the interface of dll file, that is, the interface of concrete implementation. If you only have a dll file, you can use it directly as long as you know how to export it. win32 has a corresponding api. If you want to include all the methods available in the dll in your project, you should include the header file. That is to say, the header file and the dll file correspond. In addition, if your header file already contains the implementation code, you need to provide an empty cpp file containing the header file and compile them into dll files.
C# can't directly use the header file of C++, but it can directly use the dll. The technology used is called PInvoke. The principle is to add the signature of the required method in the dll with the keyword extern in the C# code, which is the method mentioned on the second floor. In addition, if this dll is implemented by com technology, it can also be directly imported and used by using the COM interoperability features provided by the. NET platform.