comp.lang.ada
 help / color / mirror / Atom feed
From: Agyaras <agyaras@kerekerdoe.hu>
Subject: how to init static standalone library with GNAT
Date: Thu, 20 Sep 2007 13:24:08 +0200
Date: 2007-09-20T13:24:08+02:00	[thread overview]
Message-ID: <agyaras-95ECBF.13240820092007@news.inode.at> (raw)

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"



             reply	other threads:[~2007-09-20 11:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-20 11:24 Agyaras [this message]
2007-09-21 10:28 ` how to init static standalone library with GNAT Rob Norris
replies disabled

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