comp.lang.ada
 help / color / mirror / Atom feed
* packages
@ 2006-12-20 21:11 markww
       [not found] ` <mailman.4.1166651673.18371.comp.lang.ada@ada-france.org>
  0 siblings, 1 reply; 9+ messages in thread
From: markww @ 2006-12-20 21:11 UTC (permalink / raw)


Hi,

I wrote a package to be included with my main program, my directory
looks like:

     generic_list.ads  // package def
     generic_list.adb  // package body
     AdaGenericLinkedList.adb // my main program

Now I need all three to be present in the same directory to compile the
main adb file with gnat make. I see some websites suggesting Ada's
compilation method is different than C++'s, as in you don't need all
the package parts to be present in order to compile successfully, but
that doesn't seem to be the case here (if I remove generic_list.ads /
adb compilation fails).

Is there some other compilation style which lets you segment out some
files somehow?

Thanks,
Mark




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

* Re: packages
       [not found] ` <mailman.4.1166651673.18371.comp.lang.ada@ada-france.org>
@ 2006-12-20 22:03   ` markww
  2006-12-21  9:04     ` packages Martin Krischik
  2006-12-21  9:04     ` packages Martin Krischik
  2006-12-21  9:01   ` packages Martin Krischik
  1 sibling, 2 replies; 9+ messages in thread
From: markww @ 2006-12-20 22:03 UTC (permalink / raw)



Björn Lundin wrote:
> 20 dec 2006 kl. 22.11 skrev markww:
>
> > Hi,
> >
> > I wrote a package to be included with my main program, my directory
> > looks like:
> >
> >      generic_list.ads  // package def
> >      generic_list.adb  // package body
> >      AdaGenericLinkedList.adb // my main program
> >
> > Now I need all three to be present in the same directory to compile
> > the
> > main adb file with gnat make.
>
> gnatmake compiles AND builds for you
>
> try moving generic_list.adb and then _compile_ AdaGenericLinked_List.adb
>
> gcc -c AdaGenericLinked_List.adb
>
> You should get an object file of that. But to link, you need the
> generic_list.adb too
>
>
>
> /Björn
>
> Björn Lundin
> b dot f dot lundin at gmail dot com
>
>
>
>
> --Apple-Mail-1--634177642
> Content-Type: text/html; charset=ISO-8859-1
> Content-Transfer-Encoding: quoted-printable
> X-Google-AttachSize: 3765
>
> <HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>20 dec 2006 kl. 22.11 skrev markww:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hi,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I wrote a package to be included with my main program, my directory</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">looks like:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>generic_list.ads<SPAN class="Apple-converted-space">  </SPAN>// package def</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>generic_list.adb<SPAN class="Apple-converted-space">  </SPAN>// package body</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>AdaGenericLinkedList.adb // my main program</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Now I need all three to be present in the same directory to compile the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">main adb file with gnat make. <BR></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>gnatmake compiles AND builds for you</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>try moving generic_list.adb and then _compile_ AdaGenericLinked_List.adb</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>gcc -c AdaGenericLinked_List.adb</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>You should get an object file of that. But to link, you need the generic_list.adb too</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">/Björn</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Björn Lundin</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">b dot f dot lundin at gmail dot com</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></BODY></HTML>
> --Apple-Mail-1--634177642--

Ohh I see so you can compile with only the package *specification* but
in order to finalize by linking then you do need the pacakage body?

Thanks




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

* Re: packages
       [not found] ` <mailman.4.1166651673.18371.comp.lang.ada@ada-france.org>
  2006-12-20 22:03   ` packages markww
@ 2006-12-21  9:01   ` Martin Krischik
  2006-12-23 10:10     ` packages Simon Wright
  1 sibling, 1 reply; 9+ messages in thread
From: Martin Krischik @ 2006-12-21  9:01 UTC (permalink / raw)


Bj�rn Lundin schrieb:
> 
> 20 dec 2006 kl. 22.11 skrev markww:
> 
>> Hi,
>>
>> I wrote a package to be included with my main program, my directory
>> looks like:
>>
>>      generic_list.ads  // package def
>>      generic_list.adb  // package body
>>      AdaGenericLinkedList.adb // my main program
>>
>> Now I need all three to be present in the same directory to compile the
>> main adb file with gnat make.
> 
> gnatmake compiles AND builds for you
> 
> try moving generic_list.adb and then _compile_ AdaGenericLinked_List.adb
> 
> gcc -c AdaGenericLinked_List.adb
> 
> You should get an object file of that. But to link, you need the 
> generic_list.adb too

Or alternativly the .o and .ali file created from generic_list. In case 
you don't want to distribute then .ads/.adb file.

In short you need one of those to link:

1) .adb & .ads
2) .o & .ali
3) .lib & .ali
4) .dll/.so  & .ali

In C++ speak: the .ali files are kind of "precompiled header files". 
Also Note: This is the way GNAT implement the an Ada-Library-Manager. 
Other compiler might use different techniques.

Martin



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

* Re: packages
  2006-12-20 22:03   ` packages markww
@ 2006-12-21  9:04     ` Martin Krischik
  2006-12-22  9:44       ` inline expansion Stephen Leake
  2006-12-21  9:04     ` packages Martin Krischik
  1 sibling, 1 reply; 9+ messages in thread
From: Martin Krischik @ 2006-12-21  9:04 UTC (permalink / raw)
  To: markww

markww schrieb:

> Bj�rn Lundin wrote:
> 
> Ohh I see so you can compile with only the package *specification* but
> in order to finalize by linking then you do need the pacakage body?

No, see my other post.

Note that GNAT can't do inline expansion without the body - other Ada 
compiler are better in that respect.

Martin



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

* Re: packages
  2006-12-20 22:03   ` packages markww
  2006-12-21  9:04     ` packages Martin Krischik
@ 2006-12-21  9:04     ` Martin Krischik
  1 sibling, 0 replies; 9+ messages in thread
From: Martin Krischik @ 2006-12-21  9:04 UTC (permalink / raw)


markww schrieb:

> Bj�rn Lundin wrote:
> 
> Ohh I see so you can compile with only the package *specification* but
> in order to finalize by linking then you do need the pacakage body?

No, see my other post.

Note that GNAT can't do inline expansion without the body - other Ada 
compiler are better in that respect.

Martin



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

* Re: inline expansion
  2006-12-21  9:04     ` packages Martin Krischik
@ 2006-12-22  9:44       ` Stephen Leake
  2006-12-22 10:57         ` Markus E Leypold
  0 siblings, 1 reply; 9+ messages in thread
From: Stephen Leake @ 2006-12-22  9:44 UTC (permalink / raw)


Martin Krischik <krischik@users.sourceforge.net> writes:

> Note that GNAT can't do inline expansion without the body - other Ada
> compiler are better in that respect.

How can you do inline expansion without the code that is being
inlined?

-- 
-- Stephe



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

* Re: inline expansion
  2006-12-22  9:44       ` inline expansion Stephen Leake
@ 2006-12-22 10:57         ` Markus E Leypold
  2006-12-25 13:53           ` Hyman Rosen
  0 siblings, 1 reply; 9+ messages in thread
From: Markus E Leypold @ 2006-12-22 10:57 UTC (permalink / raw)



Stephen Leake <stephen_leake@stephe-leake.org> writes:

> Martin Krischik <krischik@users.sourceforge.net> writes:
>
>> Note that GNAT can't do inline expansion without the body - other Ada
>> compiler are better in that respect.
>
> How can you do inline expansion without the code that is being
> inlined?

By not using the usual object files (which are mostly a memory image
plus relocation info), instead storing a more highlevel description of
the compiled code and doing inlining during linking?

I admit I don't know what I'm talking about, but that would be how I'd
try to implement this feature.

Regards -- Markus






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

* Re: packages
  2006-12-21  9:01   ` packages Martin Krischik
@ 2006-12-23 10:10     ` Simon Wright
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Wright @ 2006-12-23 10:10 UTC (permalink / raw)


Martin Krischik <krischik@users.sourceforge.net> writes:

> In short you need one of those to link:
>
> 1) .adb & .ads
> 2) .o & .ali
> 3) .lib & .ali
> 4) .dll/.so  & .ali

If the OP's generic_list is really generic, doesn't he need both spec
and body to do the instantiation? (with GNAT).



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

* Re: inline expansion
  2006-12-22 10:57         ` Markus E Leypold
@ 2006-12-25 13:53           ` Hyman Rosen
  0 siblings, 0 replies; 9+ messages in thread
From: Hyman Rosen @ 2006-12-25 13:53 UTC (permalink / raw)


Markus E Leypold wrote:
> By not using the usual object files (which are mostly a memory image
> plus relocation info), instead storing a more highlevel description of
> the compiled code and doing inlining during linking?

That's not unlike how the C++ compiler which implements "export"
for templates does it. But of course, doing this means that the
implementors have to invent yet another intermediate format and a
set of tools to deal with it. Since the source code is a perfectly
good representation of what needs to be inlined, there's no real
need to do all that work.



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

end of thread, other threads:[~2006-12-25 13:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-20 21:11 packages markww
     [not found] ` <mailman.4.1166651673.18371.comp.lang.ada@ada-france.org>
2006-12-20 22:03   ` packages markww
2006-12-21  9:04     ` packages Martin Krischik
2006-12-22  9:44       ` inline expansion Stephen Leake
2006-12-22 10:57         ` Markus E Leypold
2006-12-25 13:53           ` Hyman Rosen
2006-12-21  9:04     ` packages Martin Krischik
2006-12-21  9:01   ` packages Martin Krischik
2006-12-23 10:10     ` packages Simon Wright

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