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-2007, 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 2, 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 COPYING. If not, write --
20 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
21 -- Boston, MA 02110-1301, USA. --
23 -- GNAT was originally developed by the GNAT team at New York University. --
24 -- Extensive contributions were provided by Ada Core Technologies Inc. --
26 ------------------------------------------------------------------------------
28 -- This is the Windows version of the body. Works only with GCC versions
29 -- supporting the "-shared" option.
32 with Output; use Output;
37 package body MLib.Tgt.Specific is
39 package Files renames MLib.Fil;
40 package Tools renames MLib.Utl;
42 -- Non default subprograms
44 procedure Build_Dynamic_Library
45 (Ofiles : Argument_List;
46 Options : Argument_List;
47 Interfaces : Argument_List;
48 Lib_Filename : String;
50 Symbol_Data : Symbol_Record;
51 Driver_Name : Name_Id := No_Name;
52 Lib_Version : String := "";
53 Auto_Init : Boolean := False);
55 function DLL_Ext return String;
57 function DLL_Prefix return String;
59 function Is_Archive_Ext (Ext : String) return Boolean;
61 function Library_Major_Minor_Id_Supported return Boolean;
63 function PIC_Option return String;
65 No_Argument_List : constant String_List := (1 .. 0 => null);
66 -- Used as value of parameter Options or Options2 in calls to Gcc
68 ---------------------------
69 -- Build_Dynamic_Library --
70 ---------------------------
72 procedure Build_Dynamic_Library
73 (Ofiles : Argument_List;
74 Options : Argument_List;
75 Interfaces : Argument_List;
76 Lib_Filename : String;
78 Symbol_Data : Symbol_Record;
79 Driver_Name : Name_Id := No_Name;
80 Lib_Version : String := "";
81 Auto_Init : Boolean := False)
83 pragma Unreferenced (Symbol_Data);
84 pragma Unreferenced (Interfaces);
85 pragma Unreferenced (Lib_Version);
86 pragma Unreferenced (Auto_Init);
88 Lib_File : constant String :=
89 Lib_Dir & Directory_Separator &
90 DLL_Prefix & Files.Append_To (Lib_Filename, DLL_Ext);
92 -- Start of processing for Build_Dynamic_Library
95 if Opt.Verbose_Mode then
96 Write_Str ("building relocatable shared library ");
97 Write_Line (Lib_File);
101 (Output_File => Lib_File,
103 Options => No_Argument_List,
104 Options_2 => Options,
105 Driver_Name => Driver_Name);
106 end Build_Dynamic_Library;
112 function DLL_Ext return String is
121 function DLL_Prefix return String is
130 function Is_Archive_Ext (Ext : String) return Boolean is
132 return Ext = ".a" or else Ext = ".dll";
135 --------------------------------------
136 -- Library_Major_Minor_Id_Supported --
137 --------------------------------------
139 function Library_Major_Minor_Id_Supported return Boolean is
142 end Library_Major_Minor_Id_Supported;
148 function PIC_Option return String is
154 Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access;
155 DLL_Ext_Ptr := DLL_Ext'Access;
156 DLL_Prefix_Ptr := DLL_Prefix'Access;
157 Is_Archive_Ext_Ptr := Is_Archive_Ext'Access;
158 PIC_Option_Ptr := PIC_Option'Access;
159 Library_Major_Minor_Id_Supported_Ptr :=
160 Library_Major_Minor_Id_Supported'Access;
161 end MLib.Tgt.Specific;