Documenting C ++ / CLI library code for use with C # - best tools and methods?

I am working on a project in which the C ++ / cli library is used mainly from a C # application.

Is there a way to make code comments in C ++ / cli visible to C # intellisence in visual studio?

Assuming no, what would be the best way to document C ++ / cli code in order to facilitate its use from C # (and within C ++ / cli, of course)? What do you think of the XML comments against doxygen vs other tools (which)?

+42
documentation documentation-generation c ++ - cli doxygen
Jun 24 '09 at 19:34
source share
5 answers

I started working as follows:

  • Use XML style comments for C ++ / CLI header entries. This means that a full XML comment is required (triple slash comments, at least the <summary> tag)

  • Make sure the C ++ compiler is enabled. Create XML documentation files . This should generate an XML documentation file with the same name as your assembly (MyDll.xml).

  • Make sure the C # project references your assembly MyDll.dll, where MyDll.xml is also present in the same folder. When you hover over a link from an assembly, MS Visual Studio will download the documentation.

This worked for me in Visual Studio 2008 on an assembly built for .NET 3.5.

+47
Jul 02 '09 at 0:27
source share

Interesting. Having tried several methods, it looks like intellisense between a managed project C ++ and C #, does not work.

The following example will give you the correct intellisense in a C ++ environment where it is declared, but a reference to an object in C # shows nothing:

 // Gets the value of my ID for the object, which is always 14. public: virtual property int MyId { int get() { return 14; } } 

XML comments do not work either. I would suggest that this is either a mistake or it requires something that I cannot understand. Judging by the lack of answers to this question, perhaps a mistake.

Regarding the creation of documentation, I would recommend going the way of XML documentation. Doxygen supports reading XML documentation , which is basically identical to the standard XML documentation for C #. It tends to add extra lines only for opening and closing tags, but, in my opinion, is much more readable than the following doxygen alternative:

 //! A normal member taking two arguments and returning an integer value. /*! \param a an integer argument. \param sa constant character pointer. \return The test results \sa Test(), ~Test(), testMeToo() and publicVar() */ 
+2
Jun 24 '09 at 19:52
source share

DocXml has the main advantage of VS support (syntax coloring, intellisense, automatic export to XML files). Doxygen tools can read the DocXml format, so you can also use them in this format.

To help you accumulate accurate and accurate Doc comments with minimal effort, you can check out my addin AtomineerUtils . This takes up most of the work of creating and updating DocXml, Doxygen, JavaDoc, or Qt comments and supports C, C ++, C ++ / CLI, C #, Java, JavaScript, TypeScript, JScript, UnrealScript, PHP, and Visual Basic code.

+2
Jul 02 '09 at 20:53
source share

You're right. This does not work. The C ++ assembly will add its IntelliSense information to the main .ncb file, and you will get autocomplete of method names, etc. However, you are right in that you cannot get a “comment” about each method, etc.

0
Jul 01 '09 at 19:42
source share

You will probably find it very helpful to take a look at Doxygen. And then find Doxygen.NET - this is what we wrote for our own use, which builds "Object Hierarchies" from the XML output files from Doxygen ...

0
Jul 01 '09 at 20:05
source share



All Articles