tags:

views:

37

answers:

2

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 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?

+1  A: 

You could create a .dll in C# to wrap it and add the documentation to that.

Blam
It would be write from some point but than I'd have a project structure like initialCPPLib, C#LibWrapper, C#App instead of just initialCPPLib and C#App... so my point is that I'd have +1 layer of depth and +1 project just for documentation... while I'd love to be able to create documentation directly in C++ code
Blender
+2  A: 

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#.

Kate Gregory