From: Gene on
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.
From: Jeffrey R. Carter on
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
From: Simon Wright on
"Jeffrey R. Carter" <spam.jrcarter.not(a)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.
From: anon on
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(a)v29g2000hsf.googlegroups.com>, Gene <gene.ressler(a)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.

From: Pascal Obry on
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