Search code examples
c#c++documentation

How can I generate documentation from a compiled c++ or c# library?


I have a third-party C++ library and a C# wrapper for it (both .dll files), and I would like to generate a list of the classes in either one that are public, and the functions they expose. How would this be done?


Solution

  • You can't. A lot of information is simply missing from the .dll files. For example, function return types and class definitions can't be found there.

    To demonstrate, these two functions emit identical assembly code:

    struct X
    {
        int a;
    };
    
    int foo() { return 1; }
    X bar() { return { 1 }; }
    

    There is a lot of other stuff that gets lost in translation. You may or may not be able to get some help from debug symbols if you want to bother parsing those, but that's pretty horrible as well.

    Do you not have header files for the C++ library? You will surely need them to compile your own code against the library interface, so why dig into the .dll?