How to add a comment in C ++ CLI, so that later when using methods of a given dll in c # you can see comments on functions and parameters?
3 answers
In .NET, a standard approach is used for all languages: xml-comments, starting with three characters /// . After compiling the dll, an xml file will be created containing the documentation. With this file, comments on the methods of this library will be visible in C # and any other language.
For more information, see XML Documentation (Visual C ++) .
For the documentation file to be created during the compilation process, the / doc compiler option must be specified. See "Setting this compiler option in the Visual Studio development environment."
I cannot fail to note: although it says there that it is translated manually, but the translation is so clumsy that it is better to switch to English if you own it. And I can also recommend using reference materials in other languages, for example, Comments on XML documentation (C # Programming Guide) .
- I put ///, but after compiling the dll, the xml file is not created. Maybe in the settings you need to put something? - boksts
- @boksts - Added. - Alexander Petrov
In pure C++ , you don’t call native functions through P/Invoke . You can use the library on Managed C++ , and create a .xml description of the functions that it contains.
I would look in the direction of the XML documentation (that is, in a separate file), I think, everything will turn out to be necessary, but I will probably have to write this file manually.