Answer the question
In order to leave comments, you need to log in
Is there a parser for header files (C++)?
Is there a ready-made parser for header files in C ++? (Alya Reflection in C #)
That is, I fed the file to the parser, and it returns the class, all its members (functions, variables, etc.)?
PS probably you can just from headra (raw) to a text file.
Alya:
//SomeHeader.h
class someclass
{
private:
int somevar;
public:
void someFunc(float a);
int someFunc2();
bool s;
}
someclass:
public:
name : "someFunc"{
type: "func"{
varType: "void"
argCount: "1"
argType: "float"
argName: "a"
}
}
name:"s"{
type:"var" {
varType:"bool"
}
}
// И т.д
Answer the question
In order to leave comments, you need to log in
An optimizing compiler can turn what is written in this header file into a 100% fiction that has no representation at all in the program. What are you going to address if the function, for example, is expanded in inline and does not have a call point at all?
Now a popular approach is to collect the types themselves already with metadata using preprocessing (Qt with its plugins) or templates (mushroom fantasies, like this one ). Something can be learned from the type traits of modern standards.
But somehow loading something in runtime that is obviously unknown (not having a known interface), especially with virtual functions, is unlikely.
Ie fed the file to the parser, and it returns the class, all its members (functions, variables, etc.)?
eval
there either, it turns out that you must first programmatically compile the code, while "deceiving" the compiler so as not to "swear" on dependencies, most likely by generating "stubs", but no one has carried out work on such a "partial" compilation, especially for C ++ with its complex syntax, which is a pity, a good tool for reverse engineering would be turned out. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question