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,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder3.cambrium.nl!feed.tweaknews.nl!newsfeed0.kamp.net!newsfeed.kamp.net!newsfeed.freenet.de!newsfeed01.chello.at!newsfeed02.chello.at!news.inode.at.POSTED!not-for-mail From: Agyaras Newsgroups: comp.lang.ada Subject: how to init static standalone library with GNAT User-Agent: MT-NewsWatcher/3.5.2 (PPC Mac OS X) Date: Thu, 20 Sep 2007 13:24:08 +0200 Message-ID: X-Complaints-To: abuse@inode.at NNTP-Posting-Host: 85.127.251.39 (85.127.251.39) NNTP-Posting-Date: Thu, 20 Sep 2007 13:22:58 +0200 X-Trace: 83fa346f25812f0da5e8212263 Xref: g2news2.google.com comp.lang.ada:2047 Date: 2007-09-20T13:24:08+02:00 List-Id: I am learning Ada right now and wrote a little standalone library as an exercise. I am using the GNAT system (2007, GPL version from AdaCore) under SuSE Linux 10.1. The library presents a private type to its clients, and this type contains a standard map. Here are the relevant parts of the spec:- with Ada.Containers.Ordered_Maps; ... package Lib is type T is private; ... private Map_Pkg is new Ada.Containers.Ordered_Maps(Key_Type, Element_Type); type T is record M: Map_Pkg.Map; ... end record; end Lib; 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 -- "Non est volentis, neque currentis, sed miserentis Dei"