From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,575dfcf6488662de X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!prodigy.com!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Libraries written in Ada Date: Mon, 22 Nov 2004 16:58:59 +0100 Organization: None Message-ID: <18687975.p80OmDsB1I@linux1.krischik.com> References: Reply-To: martin@krischik.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1101139331 01 12584 7r62Xi51hmu4-n1 041122 16:02:11 X-Complaints-To: usenet-abuse@t-online.de X-ID: EwHw12ZHgeN2cUmratN711ReA8kNXQied-asEiIVECfKX9ULzEZD6X User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:6328 Date: 2004-11-22T16:58:59+01:00 List-Id: 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