comp.lang.ada
 help / color / mirror / Atom feed
* Linking Ada code stored in a dylib
@ 2008-01-12  3:19 Jerry
  2008-01-12 10:56 ` Simon Wright
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jerry @ 2008-01-12  3:19 UTC (permalink / raw)


Several months ago, I contributed Ada bindings to the PLplot plotting
library. The PLplot developers quickly incorporated my work into their
project, including making the Ada part into a .dylib. The compiler is
GNAT.

On my end, I eventually noticed that whenever I used the bindings as
(now) downloaded from the PLplot project site, I would get new .o
and .ali files, a re-compilation of the bindings, in the directory
where my main program was. I assumed that it was something that I had
done wrong since I'm not a wizard at compiler and linker switches and
didn't worry much about it since things worked just fine. However,
when I finally bothered to tell the linker to link this .dylib, I
still saw the re-compiled .o and .ali files appearing.

I am now trying to get to the bottom of this. I re-studied the GNAT
User's Guide and its description of the compilation model and various
switches and options. I see that gnatmake checks for (time-stamp)
consistency between sources (at least .ads) and compiled files (.o
and .ali) and recompiles as necessary. The description for the -aL
switch tells how an "Ada library" consisting of a directory
containing .o and .ali files can be specified to bypass recompilation
(but subject to the consistency check), or something like that.

So now I'm inclined to believe that it is a bad or even unworkable
idea to combine compiled object files into a .dylib, and that this
method can't be used with GNAT--GNAT can't see inside the .dylib to
discover when its parts were compiled.

The PLplot developers will adapt to whatever is needed to get the job
done, I'm sure, but I want to be sure that I'm telling them the right
thing. I doubt that there is a compelling reason to use a .dylib as
opposed to a directory of relevant .o and .ali files.

Can GNAT access compiled Ada code that is stored in a .dylib? If so,
what gnatmake options would I use?

Thanks,

Jerry



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

* Re: Linking Ada code stored in a dylib
  2008-01-12  3:19 Linking Ada code stored in a dylib Jerry
@ 2008-01-12 10:56 ` Simon Wright
  2008-01-12 18:43 ` Jeffrey R. Carter
  2008-01-14 21:15 ` Jerry
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Wright @ 2008-01-12 10:56 UTC (permalink / raw)


Jerry <lanceboyle@qwest.net> writes:

> On my end, I eventually noticed that whenever I used the bindings as
> (now) downloaded from the PLplot project site, I would get new .o
> and .ali files, a re-compilation of the bindings, in the directory
> where my main program was. I assumed that it was something that I
> had done wrong since I'm not a wizard at compiler and linker
> switches and didn't worry much about it since things worked just
> fine. However, when I finally bothered to tell the linker to link
> this .dylib, I still saw the re-compiled .o and .ali files
> appearing.

Personally I can't see the point of dylibs for Ada applications, but
that's just me!

Pretty sure that to avoid your problem, the compiler needs to see the
previously-compiled .ali files, and they need to be read-only and
compiled by the same compiler (well, compatible I suppose but
different releases haven't been yet to my knowledge).

--S



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

* Re: Linking Ada code stored in a dylib
  2008-01-12  3:19 Linking Ada code stored in a dylib Jerry
  2008-01-12 10:56 ` Simon Wright
@ 2008-01-12 18:43 ` Jeffrey R. Carter
  2008-01-14 21:15 ` Jerry
  2 siblings, 0 replies; 4+ messages in thread
From: Jeffrey R. Carter @ 2008-01-12 18:43 UTC (permalink / raw)


Jerry wrote:
> 
> On my end, I eventually noticed that whenever I used the bindings as
> (now) downloaded from the PLplot project site, I would get new .o
> and .ali files, a re-compilation of the bindings, in the directory
> where my main program was. I assumed that it was something that I had
> done wrong since I'm not a wizard at compiler and linker switches and
> didn't worry much about it since things worked just fine. However,
> when I finally bothered to tell the linker to link this .dylib, I
> still saw the re-compiled .o and .ali files appearing.

GNAT will not recompile code if the .ali is read only.

-- 
Jeff Carter
"You empty-headed animal-food-trough wiper."
Monty Python & the Holy Grail
04



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

* Re: Linking Ada code stored in a dylib
  2008-01-12  3:19 Linking Ada code stored in a dylib Jerry
  2008-01-12 10:56 ` Simon Wright
  2008-01-12 18:43 ` Jeffrey R. Carter
@ 2008-01-14 21:15 ` Jerry
  2 siblings, 0 replies; 4+ messages in thread
From: Jerry @ 2008-01-14 21:15 UTC (permalink / raw)


> Can GNAT access compiled Ada code that is stored in a .dylib? If so,
> what gnatmake options would I use?
>
> Thanks,
>
> Jerry

Thanks Simon and Jeffrey for your insights.

Jerry



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

end of thread, other threads:[~2008-01-14 21:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-12  3:19 Linking Ada code stored in a dylib Jerry
2008-01-12 10:56 ` Simon Wright
2008-01-12 18:43 ` Jeffrey R. Carter
2008-01-14 21:15 ` Jerry

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