How to document functions in described technique of creating C++ .Net dll's?
So here we have a technique, and here some more on it, of creating C++ DLLs with functions readable by .Net languages such as C#.
The main Idea of technique as I use it (I开发者_如何学JAVA can be ideologically wrong but it totally works for me) - you created a C++ project, it worked, now you want to use some of its functions from C# (for example you keep logik in C and create a gui in C#, so in C# you can be just calling only one main function of ex consol C++ app turned into library)
I like this so called old-style of creating managed parts in C++ code.
So I wonder how to describe (document) C++ functions so that description will be seen in C#?
Let us look at an example (Compile with: /clr:oldSyntax)
extern "C" int _foo(int bar)
{
return bar;
}
namespace Bar
{
public __gc class Foo
{
public:
Foo() {}
static int foo(int bar)
{
return _foo(bar);
}
};
};
How can I document our foo function?
Whoah... you are using old style Managed C++ with the __gc
business. You should instead use C++/CLI where you will say public ref class Foo
. You can then use the same Doc Comments (starting with ///
and having XML in them) as you would in C#.
You could create a .dll in C# to wrap it and add the documentation to that.
精彩评论