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-2008, 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 No_Argument_List
: constant String_List
:= (1 .. 0 => null);
65 -- Used as value of parameter Options or Options2 in calls to Gcc
67 ---------------------------
68 -- Build_Dynamic_Library --
69 ---------------------------
71 procedure Build_Dynamic_Library
72 (Ofiles
: Argument_List
;
73 Options
: Argument_List
;
74 Interfaces
: Argument_List
;
75 Lib_Filename
: String;
77 Symbol_Data
: Symbol_Record
;
78 Driver_Name
: Name_Id
:= No_Name
;
79 Lib_Version
: String := "";
80 Auto_Init
: Boolean := False)
82 pragma Unreferenced
(Symbol_Data
);
83 pragma Unreferenced
(Interfaces
);
84 pragma Unreferenced
(Lib_Version
);
85 pragma Unreferenced
(Auto_Init
);
87 Lib_File
: constant String :=
88 Lib_Dir
& Directory_Separator
&
89 DLL_Prefix
& Files
.Append_To
(Lib_Filename
, DLL_Ext
);
91 -- Start of processing for Build_Dynamic_Library
94 if Opt
.Verbose_Mode
then
95 Write_Str
("building relocatable shared library ");
96 Write_Line
(Lib_File
);
100 (Output_File
=> Lib_File
,
102 Options
=> No_Argument_List
,
103 Options_2
=> Options
,
104 Driver_Name
=> Driver_Name
);
105 end Build_Dynamic_Library
;
111 function DLL_Ext
return String is
120 function DLL_Prefix
return String is
129 function Is_Archive_Ext
(Ext
: String) return Boolean is
131 return Ext
= ".a" or else Ext
= ".dll";
134 --------------------------------------
135 -- Library_Major_Minor_Id_Supported --
136 --------------------------------------
138 function Library_Major_Minor_Id_Supported
return Boolean is
141 end Library_Major_Minor_Id_Supported
;
147 function PIC_Option
return String is
153 Build_Dynamic_Library_Ptr
:= Build_Dynamic_Library
'Access;
154 DLL_Ext_Ptr
:= DLL_Ext
'Access;
155 DLL_Prefix_Ptr
:= DLL_Prefix
'Access;
156 Is_Archive_Ext_Ptr
:= Is_Archive_Ext
'Access;
157 PIC_Option_Ptr
:= PIC_Option
'Access;
158 Library_Major_Minor_Id_Supported_Ptr
:=
159 Library_Major_Minor_Id_Supported
'Access;
160 end MLib
.Tgt
.Specific
;