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.

有帮助吗?

解决方案

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");

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top