I have a main package with a normal spec and body file. I am trying to create child packages of the parent, but want them in a separate compilation file(s). I can easily get it done if it is just a package body, or if it is a subprogram/proc/func. However, I can't get it to let me make a child spec file.
The reason I am doing this is because I want to have information in a child that is available to other children of the same parent. I know I can do this by just including the spec portion in the parent, but that is making my parent file pretty big.
Is this even possible, or do I have no choice but to make another root unit? Or just leave everything spec wise in the parent?
I tried:
in parent:
package Child1 is separate;
(also tried Parent.Child1 but that gave compiles errors
in child:
separate(Parent)
package Parent.Child1 is
....
end Parent.Child1;
Ideas? Just not possible?
Update: I am compiling with Green Hills Multi Compiler. Ada95 language version, non-OO project.
Yes, this is totally fine. You can have your parent and child packages in separate files:
parent.ads
parent-child.ads
parent-other.ads:
The
parent.child
package and theparent.other
package have access to definitions inparent
(with some limitations).Notice how
parent.other
"with
s"parent.child
so that it has access to the definitions inparent.child
.I have an example of how it can be done. Also, here is an example from wikibooks.