Compile_Switch_String : aliased String := "-c";
Compile_Switch : constant String_Access := Compile_Switch_String'Access;
+ Auto_Initialize : constant String := "-a";
+
-- List of objects to put inside the library
Object_Files : Argument_List_Access;
-- Make sure that all the above tables are empty
-- (Objects, Foreign_Objects, Ali_Files, Options).
+ function SALs_Use_Constructors return Boolean;
+ -- Indicate if Stand-Alone Libraries are automatically initialized using
+ -- the constructor mechanism.
+
------------------
-- Add_Argument --
------------------
(B_Start & Get_Name_String (Data.Library_Name) & ".adb");
Add_Argument ("-L" & Get_Name_String (Data.Library_Name));
+ if Data.Lib_Auto_Init and then SALs_Use_Constructors then
+ Add_Argument (Auto_Initialize);
+ end if;
+
-- Check if Binder'Default_Switches ("Ada") is defined. If it is,
-- add these switches to call gnatbind.
Library_Projs.Init;
end Reset_Tables;
+ ---------------------------
+ -- SALs_Use_Constructors --
+ ---------------------------
+
+ function SALs_Use_Constructors return Boolean is
+ function C_SALs_Init_Using_Constructors return Integer;
+ pragma Import (C, C_SALs_Init_Using_Constructors,
+ "__gnat_sals_init_using_constructors");
+ begin
+ return C_SALs_Init_Using_Constructors /= 0;
+ end SALs_Use_Constructors;
+
end MLib.Prj;
-- This package provides a set of target dependent routines to build
-- static, dynamic and shared libraries.
--- There are several versions for the body of this package.
+-- There are several versions for the body of this package
-- In the default version, libraries are not supported, so function
-- Support_For_Libraries return None.
-- A list of options to invoke the Archive_Builder, usually "cr" for "ar"
function Archive_Indexer return String;
- -- Returns the name of the program, if any, that generates an index
- -- to the contents of an archive, usually "ranlib".
+ -- Returns the name of the program, if any, that generates an index to the
+ -- contents of an archive, usually "ranlib". If there is no archive indexer
+ -- to be used, returns an empty string.
function Archive_Indexer_Options return String_List_Access;
- -- A list of options to invoke the Archive_Indexer, usually empty.
+ -- A list of options to invoke the Archive_Indexer, usually empty
function Dynamic_Option return String;
-- gcc option to create a dynamic library.
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2004, Ada Core Technologies, Inc --
+-- Copyright (C) 2001-2005, Ada Core Technologies, Inc --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
package MLib.Utl is
- No_Argument_List : constant Argument_List := (1 .. 0 => null);
- -- Comment needed ???
-
procedure Delete_File (Filename : in String);
-- Delete the file Filename
-- Why is this different from the standard OS_Lib routine???
Options_2 : Argument_List;
Driver_Name : Name_Id := No_Name);
-- Driver_Name indicates the "driver" to invoke; by default, the "driver"
- -- is gcc.
- -- This procedure invokes the driver to create a shared library.
+ -- is gcc. This procedure invokes the driver to create a shared library.
-- Options are passed to gcc before the objects, Options_2 after.
- -- Output_File is the name of the library file to create.
- -- Objects are the names of the object files to put in the library.
+ -- Output_File is the name of the library file to create. Objects are the
+ -- names of the object files to put in the library.
procedure Ar
(Output_File : String;
Objects : Argument_List);
- -- Run ar to move all the binaries inside the archive.
- -- If ranlib is on the path, run it also.
- -- Arguments need documenting ???
+ -- Run ar to move all the binaries inside the archive. If ranlib is on the
+ -- path, run it also. Output_File is the path name of the archive to
+ -- create. Objects is the list of the path names of the object files to be
+ -- put in the archive.
function Lib_Directory return String;
-- Return the directory containing libgnat
-- Set to True if -h (-gnath for the compiler) switch encountered
-- requesting usage information
+ Use_Pragma_Linker_Constructor : Boolean := False;
+ -- GNATBIND
+ -- True if pragma Linker_Constructor applies to adainit
+
Use_VADS_Size : Boolean := False;
-- GNAT
-- Set to True if a valid pragma Use_VADS_Size is processed