1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- M L I B . T G T . S P E C I F I C --
6 -- (Windows Version) --
10 -- Copyright (C) 2002-2010, Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 3, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
20 -- http://www.gnu.org/licenses for a complete copy of the license. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 -- This is the Windows version of the body. Works only with GCC versions
28 -- supporting the "-shared" option.
31 with Output
; use Output
;
36 package body MLib
.Tgt
.Specific
is
38 package Files
renames MLib
.Fil
;
39 package Tools
renames MLib
.Utl
;
41 -- Non default subprograms
43 procedure Build_Dynamic_Library
44 (Ofiles
: Argument_List
;
45 Options
: Argument_List
;
46 Interfaces
: Argument_List
;
47 Lib_Filename
: String;
49 Symbol_Data
: Symbol_Record
;
50 Driver_Name
: Name_Id
:= No_Name
;
51 Lib_Version
: String := "";
52 Auto_Init
: Boolean := False);
54 function DLL_Ext
return String;
56 function DLL_Prefix
return String;
58 function Is_Archive_Ext
(Ext
: String) return Boolean;
60 function Library_Major_Minor_Id_Supported
return Boolean;
62 function PIC_Option
return String;
64 Shared_Libgcc
: aliased String := "-shared-libgcc";
66 Shared_Libgcc_Switch
: constant Argument_List
:=
67 (1 => Shared_Libgcc
'Access);
69 ---------------------------
70 -- Build_Dynamic_Library --
71 ---------------------------
73 procedure Build_Dynamic_Library
74 (Ofiles
: Argument_List
;
75 Options
: Argument_List
;
76 Interfaces
: Argument_List
;
77 Lib_Filename
: String;
79 Symbol_Data
: Symbol_Record
;
80 Driver_Name
: Name_Id
:= No_Name
;
81 Lib_Version
: String := "";
82 Auto_Init
: Boolean := False)
84 pragma Unreferenced
(Symbol_Data
);
85 pragma Unreferenced
(Interfaces
);
86 pragma Unreferenced
(Lib_Version
);
87 pragma Unreferenced
(Auto_Init
);
89 Lib_File
: constant String :=
90 Lib_Dir
& Directory_Separator
&
91 DLL_Prefix
& Files
.Append_To
(Lib_Filename
, DLL_Ext
);
93 -- Start of processing for Build_Dynamic_Library
96 if Opt
.Verbose_Mode
then
97 Write_Str
("building relocatable shared library ");
98 Write_Line
(Lib_File
);
102 (Output_File
=> Lib_File
,
104 Options
=> Shared_Libgcc_Switch
,
105 Options_2
=> Options
,
106 Driver_Name
=> Driver_Name
);
107 end Build_Dynamic_Library
;
113 function DLL_Ext
return String is
122 function DLL_Prefix
return String is
131 function Is_Archive_Ext
(Ext
: String) return Boolean is
133 return Ext
= ".a" or else Ext
= ".dll";
136 --------------------------------------
137 -- Library_Major_Minor_Id_Supported --
138 --------------------------------------
140 function Library_Major_Minor_Id_Supported
return Boolean is
143 end Library_Major_Minor_Id_Supported
;
149 function PIC_Option
return String is
155 Build_Dynamic_Library_Ptr
:= Build_Dynamic_Library
'Access;
156 DLL_Ext_Ptr
:= DLL_Ext
'Access;
157 DLL_Prefix_Ptr
:= DLL_Prefix
'Access;
158 Is_Archive_Ext_Ptr
:= Is_Archive_Ext
'Access;
159 PIC_Option_Ptr
:= PIC_Option
'Access;
160 Library_Major_Minor_Id_Supported_Ptr
:=
161 Library_Major_Minor_Id_Supported
'Access;
162 end MLib
.Tgt
.Specific
;