Question

Lets say you have a client and a server project where these have some packages in common. Is it possible to produce two exec files (client, server) from a single Ada project?

Using Ada 2012 with Gnat.

Was it helpful?

Solution

Yes. You can see an example of how to do it in the project files in my LEGO Tools repository. The critical part is to list the relevant compilation units in a "Main" clause in the project file like this:

for Main use ("build_mpd_file",
              "fractal_landscape",
              "outline_boundaries",
              "pgm_to_ldraw",
              "split_ldraw_file");

OTHER TIPS

Yes.
There's nothing special about a subprogram that is to be the main portion of the executable. (There are some restrictions though; IIRC it has to be a paramaterless subprogram, and if a function has to return Integer.)

For GNAT, all that's needed is for you to specify which compilation-units are main files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top