comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <martin@krischik.com>
Subject: Re: Libraries written in Ada
Date: Mon, 22 Nov 2004 16:58:59 +0100
Date: 2004-11-22T16:58:59+01:00	[thread overview]
Message-ID: <18687975.p80OmDsB1I@linux1.krischik.com> (raw)
In-Reply-To: pan.2004.11.22.11.32.38.595826@ID-174572.user.uni-berlin.de

Thomas Lotze wrote:

> I'm thinking about developing a library implementing a document model and
> file format, and it seems Ada is a good choice of language for that. I
> wonder, however, whether Ada's runtime environment doesn't count as a con
> there.
> 
> The problem is not that it has to be initialized when using the library
> from another language, e.g. C. Many libraries need some initialization.
> But suppose I use two libs written in Ada in the same C program - will
> there be problems with the runtime environment? I don't think there
> should, just asking for your experience to be sure. (I also considered
> OCaml, and it's a problem there. But linking works differently with OCaml
> so that each lib effectively brings it's own runtime environment.)
> 
> Can the runtime environment and its initialization be omitted completely
> by dropping runtime checks on variable bounds etc?

No, Ada packages allow for initialization code to included. Ada itself makes
shure all initialisation code is executed - even when several libraries are
combined. This happens automaticly when the main procedure is written in
Ada.

When main is written in another language then the standard demands that
"some form of initialisation" is provided. In GNAT this is done be:

void adainit (void);

You can request another name if you like or need.

The GNAT binder will generate this procedure for you and it will init all
libraries involved.

The good thing about Ada is that the ISO standard demands that if
interfacing with a language is allowed then one must allow main in that
language as well and must provide a way to initializing the runtime
environment. - Its not an optional exta.

The ISO Standart also defines interfacing with C, FORTRAN and COBOL. AFAIK
Ada is the only language where interfacing with other languages is defined
that strict.

Well the Standard does not say anything about DLLs. However, at least GNAT
can encapsulate the runtime initialisation on DLL level as well - making
shure that no DLL is initialized twice even when a "diamond" is the DLL
hirachie.

No realy no prob here.

With Regards

Martin

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com



  reply	other threads:[~2004-11-22 15:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-22 11:32 Libraries written in Ada Thomas Lotze
2004-11-22 15:58 ` Martin Krischik [this message]
2004-11-22 16:28   ` Thomas Lotze
2004-11-22 16:46     ` Alex R. Mosteo
2004-11-22 19:09       ` Pascal Obry
2004-11-23 11:12         ` Alex R. Mosteo
2004-11-22 17:59     ` Martin Krischik
2004-11-22 20:36       ` Thomas Lotze
2004-11-22 21:25         ` Georg Bauhaus
2004-11-22 21:45           ` Thomas Lotze
2004-11-22 22:07             ` Georg Bauhaus
2004-11-22 22:27               ` Thomas Lotze
2004-11-23  9:54                 ` Adrien Plisson
2004-11-23  9:55                 ` Martin Krischik
2004-11-23  9:55               ` Martin Krischik
2004-11-23  9:48         ` Martin Krischik
2004-11-23 11:03           ` Thomas Lotze
2004-11-23 11:38             ` Alex R. Mosteo
2004-11-23 12:22               ` Georg Bauhaus
2004-11-23 13:20                 ` Alex R. Mosteo
2004-11-23 13:40                   ` Alex R. Mosteo
2004-11-23 12:36             ` Martin Krischik
2004-11-23 13:53               ` Thomas Lotze
2004-11-23 18:39                 ` Jeffrey Carter
2004-11-22 20:45       ` Georg Bauhaus
replies disabled

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