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 Foreign : Argument_List;
47 Afiles : Argument_List;
48 Options : Argument_List;
49 Options_2 : Argument_List;
50 Interfaces : Argument_List;
51 Lib_Filename : String;
53 Symbol_Data : Symbol_Record;
54 Driver_Name : Name_Id := No_Name;
55 Lib_Version : String := "";
56 Auto_Init : Boolean := False);
58 function DLL_Ext return String;
60 function DLL_Prefix return String;
62 function Is_Archive_Ext (Ext : String) return Boolean;
64 function PIC_Option return String;
66 No_Argument_List : constant String_List := (1 .. 0 => null);
67 -- Used as value of parameter Options or Options2 in calls to Gcc
69 ---------------------------
70 -- Build_Dynamic_Library --
71 ---------------------------
73 procedure Build_Dynamic_Library
74 (Ofiles : Argument_List;
75 Foreign : Argument_List;
76 Afiles : Argument_List;
77 Options : Argument_List;
78 Options_2 : Argument_List;
79 Interfaces : Argument_List;
80 Lib_Filename : String;
82 Symbol_Data : Symbol_Record;
83 Driver_Name : Name_Id := No_Name;
84 Lib_Version : String := "";
85 Auto_Init : Boolean := False)
87 pragma Unreferenced (Foreign);
88 pragma Unreferenced (Afiles);
89 pragma Unreferenced (Symbol_Data);
90 pragma Unreferenced (Interfaces);
91 pragma Unreferenced (Lib_Version);
92 pragma Unreferenced (Auto_Init);
94 Lib_File : constant String :=
95 Lib_Dir & Directory_Separator &
96 Files.Append_To (Lib_Filename, DLL_Ext);
98 -- Start of processing for Build_Dynamic_Library
101 if Opt.Verbose_Mode then
102 Write_Str ("building relocatable shared library ");
103 Write_Line (Lib_File);
107 (Output_File => Lib_File,
109 Options => No_Argument_List,
110 Options_2 => Options & Options_2,
111 Driver_Name => Driver_Name);
112 end Build_Dynamic_Library;
118 function DLL_Ext return String is
127 function DLL_Prefix return String is
136 function Is_Archive_Ext (Ext : String) return Boolean is
138 return Ext = ".a" or else Ext = ".dll";
145 function PIC_Option return String is
151 Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access;
152 DLL_Ext_Ptr := DLL_Ext'Access;
153 DLL_Prefix_Ptr := DLL_Prefix'Access;
154 Is_Archive_Ext_Ptr := Is_Archive_Ext'Access;
155 PIC_Option_Ptr := PIC_Option'Access;
156 end MLib.Tgt.Specific;