11

In short: I am looking for something like Roslyn but for C++.

In detail:

I am dealing with a c# project where I have to work with c++ files. I have a bunch of .h (about 250 files) and .cpp and I would like to map the classes and functions and what not, that are defined in these files.

It is for a modeling task. I do not wish to use the actual c++ library.

I did not write the c++ code, so I cannot be sure if there are nested classes anywhere. So this is not a "simple" regex task.

The project is in c#, and the library I'd like to use is in c++. I cannot change that.

2
  • 2
    Even if there were no nested classes, that still would not be a "simple" thing to do. What about template instantiations? For what it's worth, this is what the Clang guys are trying to do, but AFAIK it's a big pain to get working on some platforms. Commented Apr 17, 2012 at 22:15
  • 1
    possible duplicate of How to parse/simple analyze C/C++ code from C# to get a list of methods Commented Apr 17, 2012 at 22:36

1 Answer 1

12

I believe libclang has the functionality you want. It's basically a C interface for accessing much of the information stored in clang's C/C++ AST. The documentation is a bit terse so here is a good video on what it can do with some examples.

Sign up to request clarification or add additional context in comments.

1 Comment

You convinced me. :) I started to work with libclang. The video was a very good start for me. Any more tutorials/walkthroughs you recommend?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.