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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,eb60fe3e1c1adafc X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.glorb.com!news-peer-lilac.gradwell.net!not-for-mail From: Rob Norris Newsgroups: comp.lang.ada Subject: Re: how to init static standalone library with GNAT Date: Fri, 21 Sep 2007 11:28:37 +0100 Message-ID: References: X-Newsreader: Forte Free Agent 3.3/32.846 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Original-NNTP-Posting-Host: glkas0286.greenlnk.net NNTP-Posting-Host: 20.133.0.1 X-Trace: 1190370535 news.gradwell.net 769 dnews/20.133.0.1:51290 X-Complaints-To: news-abuse@gradwell.net Xref: g2news2.google.com comp.lang.ada:2064 Date: 2007-09-21T11:28:37+01:00 List-Id: On Thu, 20 Sep 2007 13:24:08 +0200, Agyaras wrote: >When I compile & link the library as dynamic standalone with >auto-initialization, then it works nicely. When I use static linking, >then it crashes when the map is accessed in T. Obviously the map needs >some initialization and auto-init is not done for static libraries (says >so in the manual). > >Now, I prefer to use static libraries as in my experience (with other >languages) linking and distributing dynamic libs was always a hassle. My >question is:- can one initialize a standalone static library in the GNAT >system? If yes, then how? Is that solution portable to other compilers? > >Thanks for any hints & pointers, >Agyaras Perhaps you'll have to add routines Initialise and Is_Initialised. Then clients *have* to ensure the library initialised before real use. Not the most elegant solution, but should force things to work. The initialise rotuine would have to call the internal auto-initiialise (however that is done*). The Is_Initialised function would have to determine the state somehow*. *Implementation details left as an exercise for the reader (because I don't know how).