* Package procedure as program entry in GPR project
@ 2019-01-25 15:12 Jesper Quorning
2019-01-25 17:05 ` Jere
2019-01-25 21:42 ` Randy Brukardt
0 siblings, 2 replies; 6+ messages in thread
From: Jesper Quorning @ 2019-01-25 15:12 UTC (permalink / raw)
Hello All,
With the package specifikation:
package My_Program_Package is
procedure Program_Entry_Procedure;
end My_Program_Package;
How do i make Program_Entry_Procedure as the program entry procedure in a GPR project?
I think it is possible, but can not find out how.
I know how to use a stand-alone procedure file as program entry and how to name the executable.
Thanks from
Jesper
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Package procedure as program entry in GPR project
2019-01-25 15:12 Package procedure as program entry in GPR project Jesper Quorning
@ 2019-01-25 17:05 ` Jere
2019-01-25 21:42 ` Randy Brukardt
1 sibling, 0 replies; 6+ messages in thread
From: Jere @ 2019-01-25 17:05 UTC (permalink / raw)
On Friday, January 25, 2019 at 10:12:24 AM UTC-5, Jesper Quorning wrote:
> Hello All,
>
> With the package specifikation:
>
> package My_Program_Package is
> procedure Program_Entry_Procedure;
> end My_Program_Package;
>
> How do i make Program_Entry_Procedure as the program entry procedure in a GPR project?
>
> I think it is possible, but can not find out how.
>
> I know how to use a stand-alone procedure file as program entry and how to name the executable.
>
>
> Thanks from
> Jesper
With that specific setup, I am not sure. But if you are willing to change
a couple of things you can do:
-- my_program_package.ads
package My_Program_Package is
-- Notice no declaration here for the procedure, but you can put other
-- things if you like
end My_Program_Package;
-- my_program_package-program_entry_procedure.adb
procedure My_Program_Package.Program_Entry_Procedure is
begin
-- your main stuff
end My_Program_Package.Program_Entry_Procedure;
Then you modify the GPR file to point to it as the main:
for Main use ("my_program_package-program_entry_procedure.adb");
I do something similar for my Gnoga GUI projects so I can have
program level stuff in the top package but have the main a child
of that top level package.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Package procedure as program entry in GPR project
2019-01-25 15:12 Package procedure as program entry in GPR project Jesper Quorning
2019-01-25 17:05 ` Jere
@ 2019-01-25 21:42 ` Randy Brukardt
2019-01-26 1:47 ` Jesper Quorning
2019-01-26 12:05 ` Simon Wright
1 sibling, 2 replies; 6+ messages in thread
From: Randy Brukardt @ 2019-01-25 21:42 UTC (permalink / raw)
"Jesper Quorning" <jesper.quorning@gmail.com> wrote in message
news:9c44582e-faff-4498-88e1-c8715471e857@googlegroups.com...
> Hello All,
>
> With the package specifikation:
>
> package My_Program_Package is
> procedure Program_Entry_Procedure;
> end My_Program_Package;
>
> How do i make Program_Entry_Procedure as the program entry procedure in a
> GPR project?
I realize you are asking for GPR, so by definition you don't care about
portability, but:
Ada only requires Ada implementations to support library-level procedures as
the main. See 10.2(29). A particular implementation can allow more, but
there is no requirement.
So if you ever might want to use some other Ada compiler (I for one, hope
so), use such a routine.
It's trivial to write one, after all:
with My_Program_Package;
procedure My_Program_Main is
begin
My_Program_Package.Program_Entry_Procedure;
end My_Program_Main;
Randy.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Package procedure as program entry in GPR project
2019-01-25 21:42 ` Randy Brukardt
@ 2019-01-26 1:47 ` Jesper Quorning
2019-01-26 12:05 ` Simon Wright
1 sibling, 0 replies; 6+ messages in thread
From: Jesper Quorning @ 2019-01-26 1:47 UTC (permalink / raw)
I just wanted a way to avoid the trivial main file.
I also considered
package simple is
procedure main
end simple;
package body simple is
procedure main is
begin
...
end main;
private
main;
end simple;
But GPR would not do that either. I will stick to the simple procedure file.
Thanks
Jesper
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Package procedure as program entry in GPR project
2019-01-25 21:42 ` Randy Brukardt
2019-01-26 1:47 ` Jesper Quorning
@ 2019-01-26 12:05 ` Simon Wright
2019-01-26 12:08 ` Simon Wright
1 sibling, 1 reply; 6+ messages in thread
From: Simon Wright @ 2019-01-26 12:05 UTC (permalink / raw)
"Randy Brukardt" <randy@rrsoftware.com> writes:
> "Jesper Quorning" <jesper.quorning@gmail.com> wrote in message
> news:9c44582e-faff-4498-88e1-c8715471e857@googlegroups.com...
[...]
>> package My_Program_Package is
>> procedure Program_Entry_Procedure;
>> end My_Program_Package;
>>
>> How do i make Program_Entry_Procedure as the program entry procedure
>> in a GPR project?
>
> I realize you are asking for GPR, so by definition you don't care
> about portability, but:
>
> Ada only requires Ada implementations to support library-level
> procedures as the main. See 10.2(29). A particular implementation can
> allow more, but there is no requirement.
This isn't a GPR thing, it's a GNAT thing: GNAT has no extensions here
beyond the requirement.
If you have a minimal bare-board project without any requirement for the
Ada runtime system, it's possible to do what you ask: see Maciej
Sobczak's 'Ada and SPARK on ARM Cortex-M' tutorial[1], in particular the
'First Chapter'[2].
It would be hard (and pointless) to attempt this for a program intended
to run on a typical operating system.
[1] http://www.inspirel.com/articles/Ada_On_Cortex.html
[2] http://www.inspirel.com/articles/Ada_On_Cortex_First_Program.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Package procedure as program entry in GPR project
2019-01-26 12:05 ` Simon Wright
@ 2019-01-26 12:08 ` Simon Wright
0 siblings, 0 replies; 6+ messages in thread
From: Simon Wright @ 2019-01-26 12:08 UTC (permalink / raw)
Simon Wright <simon@pushface.org> writes:
> in particular the 'First Chapter'[2].
ugh, read 'First Program'
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-01-26 12:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-25 15:12 Package procedure as program entry in GPR project Jesper Quorning
2019-01-25 17:05 ` Jere
2019-01-25 21:42 ` Randy Brukardt
2019-01-26 1:47 ` Jesper Quorning
2019-01-26 12:05 ` Simon Wright
2019-01-26 12:08 ` Simon Wright
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox