I want to save a tree (specifically the type of a tree) in a file in binary form, and I need to load this tree in other compilation unit. For example:
I have a main.c with 2 function:
myTypeStruct getWhatever(){
myTypeStruct my;
... doSomething ...
return my;
}
int main(){
myTypeStruct my = getWhatever();
... doSomething else with my...
}
and I want to save the type of the structure (myTypeStruct) and load it into another compilation unit involving a test.c as:
int main(){
... doSomeTest ...
}
With a gcc plugin, I want to load the type and build a variable of that type to transform test.c in something like:
int main(){
myTypeStruct my;
... doSomething with my...
... doSomeTest ...
}
I know that a tree is a pointer to a tree_node, and a tree_node is a union of structures. The problem is that a tree has a relationship with it, and with a series of unintelligible structures. I need to know which data need a tree when building a variable of a specific type.
PD: There is insufficient documentation about how LTO do things like that. PD2: sorry for my English