comp.lang.ada
 help / color / mirror / Atom feed
* Compilation without implementation source
@ 2008-01-27  3:34 Gene
  2008-01-27 17:04 ` Jeffrey R. Carter
  2008-01-27 19:54 ` anon
  0 siblings, 2 replies; 6+ messages in thread
From: Gene @ 2008-01-27  3:34 UTC (permalink / raw)


For an educational exercise using GNAT and gnatmake, I need to hide
implementations of some modules from students in the simplest possible
way.

Is there a way to give them .ali, .ads, and .o files while withholding
the corresponding .adb, somehow telling gnatmake (and gnatbind) to
ignore the absence?

Or must I provide a library?

Other methods?

Many thanks for your help.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compilation without implementation source
  2008-01-27  3:34 Compilation without implementation source Gene
@ 2008-01-27 17:04 ` Jeffrey R. Carter
  2008-01-27 17:25   ` Simon Wright
  2008-01-27 19:54 ` anon
  1 sibling, 1 reply; 6+ messages in thread
From: Jeffrey R. Carter @ 2008-01-27 17:04 UTC (permalink / raw)


Gene wrote:
> For an educational exercise using GNAT and gnatmake, I need to hide
> implementations of some modules from students in the simplest possible
> way.
> 
> Is there a way to give them .ali, .ads, and .o files while withholding
> the corresponding .adb, somehow telling gnatmake (and gnatbind) to
> ignore the absence?

IIRC, if the .ali files are read-only, GNAT will not require the source of the 
bodies. This may not work for generics or other cases where the compilation has 
a dependency on the body, such as cross-unit inlining.

-- 
Jeff Carter
"Whatever it is, I'm against it."
Horse Feathers
46



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compilation without implementation source
  2008-01-27 17:04 ` Jeffrey R. Carter
@ 2008-01-27 17:25   ` Simon Wright
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Wright @ 2008-01-27 17:25 UTC (permalink / raw)


"Jeffrey R. Carter" <spam.jrcarter.not@acm.nospam.org> writes:

> Gene wrote:
>> For an educational exercise using GNAT and gnatmake, I need to hide
>> implementations of some modules from students in the simplest possible
>> way.
>>
>> Is there a way to give them .ali, .ads, and .o files while withholding
>> the corresponding .adb, somehow telling gnatmake (and gnatbind) to
>> ignore the absence?
>
> IIRC, if the .ali files are read-only, GNAT will not require the
> source of the bodies. This may not work for generics or other cases
> where the compilation has a dependency on the body, such as cross-unit
> inlining.

This is pretty close to what gnatmake will do if you give it a
'library' gpr.

I haven't been able to get it to elaborate a static library with
unnecessary sources hidden - and I haven't tried dynamic libraries
yet. Others will know more.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compilation without implementation source
  2008-01-27  3:34 Compilation without implementation source Gene
  2008-01-27 17:04 ` Jeffrey R. Carter
@ 2008-01-27 19:54 ` anon
  2008-01-27 19:59   ` Pascal Obry
  1 sibling, 1 reply; 6+ messages in thread
From: anon @ 2008-01-27 19:54 UTC (permalink / raw)


In GNAT you only need the "*.ads" to compile. The Binding process 
needs only the *.ali of the all files used. The Linking process needs 
the main program ".ali", the files that are created by the binding 
process and objject files "*.o" for the files used. Along with the 
Standard GNAT files. The body "*.adb" are only needed to compile 
the modules initially.

So, 
    1. Copy the modules to a temp directory both "*.adb" and "*.ads"
    2. Compile each of the modules. 
    3. Erase the "body" aka "*.adb"
    4. Copy the "*.ads *.ali *.o" to a students accessable directory 
       with write protection turn on.
    5. This gives the student access to the *.als *.ali, *.o only.



In <43c33a30-8f1e-43a1-b84a-a22c4a37248a@v29g2000hsf.googlegroups.com>, Gene <gene.ressler@gmail.com> writes:
>For an educational exercise using GNAT and gnatmake, I need to hide
>implementations of some modules from students in the simplest possible
>way.
>
>Is there a way to give them .ali, .ads, and .o files while withholding
>the corresponding .adb, somehow telling gnatmake (and gnatbind) to
>ignore the absence?
>
>Or must I provide a library?
>
>Other methods?
>
>Many thanks for your help.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compilation without implementation source
  2008-01-27 19:54 ` anon
@ 2008-01-27 19:59   ` Pascal Obry
  2008-01-28  4:58     ` Gene
  0 siblings, 1 reply; 6+ messages in thread
From: Pascal Obry @ 2008-01-27 19:59 UTC (permalink / raw)
  To: anon

anon a �crit :

> The body "*.adb" are only needed to compile 
> the modules initially.

Which is wrong as explained Jeffrey Carter 3 hours ago!

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compilation without implementation source
  2008-01-27 19:59   ` Pascal Obry
@ 2008-01-28  4:58     ` Gene
  0 siblings, 0 replies; 6+ messages in thread
From: Gene @ 2008-01-28  4:58 UTC (permalink / raw)


On Jan 27, 2:59 pm, Pascal Obry <pas...@obry.net> wrote:
> anon a écrit :
>
> > The body "*.adb" are only needed to compile
> > the modules initially.
>
> Which is wrong as explained Jeffrey Carter 3 hours ago!
>
> Pascal.
>

Thanks guys.

Happily, the files I need to hide contain neither generics nor inlined
procedures.

I had tried the read-only marking already before I posted.  What had
me stumped was the need to delete all the .ali's of _non_-hidden flies
then rebuild.  Before doing that, the binder demanded the missing
source.  Afterward, all was okay.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-01-28  4:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-27  3:34 Compilation without implementation source Gene
2008-01-27 17:04 ` Jeffrey R. Carter
2008-01-27 17:25   ` Simon Wright
2008-01-27 19:54 ` anon
2008-01-27 19:59   ` Pascal Obry
2008-01-28  4:58     ` Gene

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox