-- --
-- B o d y --
-- --
--- $Revision: 1.6 $
+-- $Revision$
-- --
--- Copyright (C) 1997-2000, Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2001, Free Software Foundation, 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- --
procedure Syntax;
-- print out usage.
- procedure Check (Filename : in String);
+ procedure Check (Filename : String);
-- check that filename exist.
procedure Parse_Command_Line;
procedure Check_Context;
-- check the context before runing any commands to build the library.
-
-
Syntax_Error : exception;
Context_Error : exception;
Largs_Options : Argument_List_Access := Null_Argument_List_Access;
Bargs_Options : Argument_List_Access := Null_Argument_List_Access;
-
type Build_Mode_State is (Import_Lib, Dynamic_Lib, Nil);
Build_Mode : Build_Mode_State := Nil;
procedure Syntax is
use Text_IO;
+
+ procedure P (Str : in String) renames Text_IO.Put_Line;
+
begin
- Put_Line ("Usage : gnatdll [options] [list-of-files]");
+ P ("Usage : gnatdll [options] [list-of-files]");
New_Line;
- Put_Line
- ("[list-of-files] a list of Ada libraries (.ali) and/or " &
+ P ("[list-of-files] a list of Ada libraries (.ali) and/or " &
"foreign object files");
New_Line;
- Put_Line ("[options] can be");
- Put_Line (" -h help - display this message");
- Put_Line (" -v verbose");
- Put_Line (" -q quiet");
- Put_Line (" -k remove @nn suffix from exported names");
- Put_Line (" -Idir Specify source and object files search path");
-
- Put_Line (" -l file " &
- "file contains a list-of-files to be added to the library");
- Put_Line (" -e file definition file containing exports");
- Put_Line
- (" -d file put objects in the relocatable dynamic library <file>");
- Put_Line (" -a[addr] build non-relocatable DLL at address <addr>");
- Put_Line (" if <addr> is not specified use " &
- Default_DLL_Address);
- Put_Line (" -n no-import - do not create the import library");
- Put_Line (" -bargs binder option");
- Put_Line (" -largs linker (library builder) option");
+ P ("[options] can be");
+ P (" -h Help - display this message");
+ P (" -v Verbose");
+ P (" -q Quiet");
+ P (" -k Remove @nn suffix from exported names");
+ P (" -g Generate debugging information");
+ P (" -Idir Specify source and object files search path");
+ P (" -l file File contains a list-of-files to be added to "
+ & "the library");
+ P (" -e file Definition file containing exports");
+ P (" -d file Put objects in the relocatable dynamic "
+ & "library <file>");
+ P (" -a[addr] Build non-relocatable DLL at address <addr>");
+ P (" if <addr> is not specified use "
+ & Default_DLL_Address);
+ P (" -n No-import - do not create the import library");
+ P (" -bargs opts opts are passed to the binder");
+ P (" -largs opts opts are passed to the linker");
end Syntax;
-----------
-- scan gnatdll switches
loop
- case Getopt ("h v q k a? d: e: l: n I:") is
+ case Getopt ("g h v q k a? d: e: l: n I:") is
when ASCII.Nul =>
exit;
when 'h' =>
Help := True;
+ when 'g' =>
+ Gopts (G) := new String'("-g");
+ G := G + 1;
+
when 'v' =>
-- verbose mode on.
case Build_Mode is
when Import_Lib =>
- MDLL.Build_Import_Library (To_String (Lib_Filename),
- To_String (Def_Filename));
+ MDLL.Build_Import_Library
+ (To_String (Lib_Filename),
+ To_String (Def_Filename));
when Dynamic_Lib =>
MDLL.Build_Dynamic_Library
-- --
-- B o d y --
-- --
--- $Revision: 1.4 $
+-- $Revision$
-- --
--- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2001 Free Software Foundation, 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- --
---------------------------
procedure Build_Dynamic_Library
- (Ofiles : in Argument_List;
- Afiles : in Argument_List;
- Options : in Argument_List;
- Bargs_Options : in Argument_List;
- Largs_Options : in Argument_List;
- Lib_Filename : in String;
- Def_Filename : in String;
- Lib_Address : in String := "";
- Build_Import : in Boolean := False;
- Relocatable : in Boolean := False)
+ (Ofiles : Argument_List;
+ Afiles : Argument_List;
+ Options : Argument_List;
+ Bargs_Options : Argument_List;
+ Largs_Options : Argument_List;
+ Lib_Filename : String;
+ Def_Filename : String;
+ Lib_Address : String := "";
+ Build_Import : Boolean := False;
+ Relocatable : Boolean := False)
is
use type OS_Lib.Argument_List;
All_Options : constant Argument_List := Options & Largs_Options;
-
procedure Build_Reloc_DLL;
- -- build a relocatable DLL with only objects file specified.
+ -- Build a relocatable DLL with only objects file specified.
-- this use the well known 5 steps build. (see GNAT User's Guide).
procedure Ada_Build_Reloc_DLL;
- -- build a relocatable DLL with Ada code.
+ -- Build a relocatable DLL with Ada code.
-- this use the well known 5 steps build. (see GNAT User's Guide).
procedure Build_Non_Reloc_DLL;
- -- build a non relocatable DLL containing no Ada code.
+ -- Build a non relocatable DLL containing no Ada code.
procedure Ada_Build_Non_Reloc_DLL;
- -- build a non relocatable DLL with Ada code.
+ -- Build a non relocatable DLL with Ada code.
---------------------
-- Build_Reloc_DLL --
procedure Build_Reloc_DLL is
- -- objects plus the export table (.exp) file
+ -- Objects plus the export table (.exp) file
Objects_Exp_File : OS_Lib.Argument_List
:= Exp_File'Unchecked_Access & Ofiles;
end if;
end if;
- -- 1) build base file with objects files.
+ -- 1) Build base file with objects files.
Tools.Gcc (Output_File => Jnk_File,
Files => Ofiles,
Base_File => Bas_File,
Build_Lib => True);
- -- 2) build exp from base file.
+ -- 2) Build exp from base file.
Tools.Dlltool (Def_File, Dll_File, Lib_File,
Base_File => Bas_File,
Exp_Table => Exp_File,
Build_Import => False);
- -- 3) build base file with exp file and objects files.
+ -- 3) Build base file with exp file and objects files.
Tools.Gcc (Output_File => Jnk_File,
Files => Objects_Exp_File,
Base_File => Bas_File,
Build_Lib => True);
- -- 4) build new exp from base file and the lib file (.a)
+ -- 4) Build new exp from base file and the lib file (.a)
Tools.Dlltool (Def_File, Dll_File, Lib_File,
Base_File => Bas_File,
Exp_Table => Exp_File,
Build_Import => Build_Import);
- -- 5) build the dynamic library
+ -- 5) Build the dynamic library
Tools.Gcc (Output_File => Dll_File,
Files => Objects_Exp_File,
end if;
end if;
- -- 1) build base file with objects files.
+ -- 1) Build base file with objects files.
Tools.Gnatbind (Afiles, Options & Bargs_Options);
Params);
end;
- -- 2) build exp from base file.
+ -- 2) Build exp from base file.
Tools.Dlltool (Def_File, Dll_File, Lib_File,
Base_File => Bas_File,
Exp_Table => Exp_File,
Build_Import => False);
- -- 3) build base file with exp file and objects files.
+ -- 3) Build base file with exp file and objects files.
Tools.Gnatbind (Afiles, Options & Bargs_Options);
Params);
end;
- -- 4) build new exp from base file and the lib file (.a)
+ -- 4) Build new exp from base file and the lib file (.a)
Tools.Dlltool (Def_File, Dll_File, Lib_File,
Base_File => Bas_File,
Exp_Table => Exp_File,
Build_Import => Build_Import);
- -- 5) build the dynamic library
+ -- 5) Build the dynamic library
Tools.Gnatbind (Afiles, Options & Bargs_Options);
end if;
end if;
- -- build exp table and the lib .a file.
+ -- Build exp table and the lib .a file.
Tools.Dlltool (Def_File, Dll_File, Lib_File,
Exp_Table => Exp_File,
Build_Import => Build_Import);
- -- build the DLL
+ -- Build the DLL
Tools.Gcc (Output_File => Dll_File,
Files => Exp_File'Unchecked_Access & Ofiles,
-- Ada_Build_Non_Reloc_DLL --
-----------------------------
- -- build a non relocatable DLL with Ada code.
+ -- Build a non relocatable DLL with Ada code.
procedure Ada_Build_Non_Reloc_DLL is
begin
end if;
end if;
- -- build exp table and the lib .a file.
+ -- Build exp table and the lib .a file.
Tools.Dlltool (Def_File, Dll_File, Lib_File,
Exp_Table => Exp_File,
Build_Import => Build_Import);
- -- build the DLL
+ -- Build the DLL
Tools.Gnatbind (Afiles, Options & Bargs_Options);
-- Build_Import_Library --
--------------------------
- procedure Build_Import_Library (Lib_Filename : in String;
- Def_Filename : in String) is
+ procedure Build_Import_Library
+ (Lib_Filename : String;
+ Def_Filename : String)
+ is
- procedure Build_Import_Library (Def_Base_Filename : in String);
- -- build an import library.
+ procedure Build_Import_Library (Def_Base_Filename : String);
+ -- Build an import library.
-- this is to build only a .a library to link against a DLL.
Base_Filename : constant String := MDLL.Files.Ext_To (Lib_Filename);
-- Build_Import_Library --
--------------------------
- procedure Build_Import_Library (Def_Base_Filename : in String) is
+ procedure Build_Import_Library (Def_Base_Filename : String) is
Def_File : String renames Def_Filename;
Dll_File : constant String := Def_Base_Filename & ".dll";
end Build_Import_Library;
begin
- -- if the library has the form lib<name>.a then the def file should
+ -- If the library has the form lib<name>.a then the def file should
-- be <name>.def and the DLL to link against <name>.dll
-- this is a Windows convention and we try as much as possible to
-- follow the platform convention.
-- --
-- S p e c --
-- --
--- $Revision: 1.5 $
+-- $Revision$
-- --
--- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2001 Free Software Foundation, 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- --
Kill_Suffix : Boolean := False;
- procedure Build_Dynamic_Library (Ofiles : in Argument_List;
- Afiles : in Argument_List;
- Options : in Argument_List;
- Bargs_Options : in Argument_List;
- Largs_Options : in Argument_List;
- Lib_Filename : in String;
- Def_Filename : in String;
- Lib_Address : in String := "";
- Build_Import : in Boolean := False;
- Relocatable : in Boolean := False);
- -- build a DLL and the import library to link against the DLL.
+ procedure Build_Dynamic_Library
+ (Ofiles : Argument_List;
+ Afiles : Argument_List;
+ Options : Argument_List;
+ Bargs_Options : Argument_List;
+ Largs_Options : Argument_List;
+ Lib_Filename : String;
+ Def_Filename : String;
+ Lib_Address : String := "";
+ Build_Import : Boolean := False;
+ Relocatable : Boolean := False);
+ -- Build a DLL and the import library to link against the DLL.
-- this function handles relocatable and non relocatable DLL.
-- If the Afiles argument list contains some Ada units then it will
-- generate the right adainit and adafinal and integrate it in the DLL.
-- provided) then it will not try to build a binder file. This is ok to
-- build DLL containing no Ada code.
- procedure Build_Import_Library (Lib_Filename : in String;
- Def_Filename : in String);
+ procedure Build_Import_Library
+ (Lib_Filename : String;
+ Def_Filename : String);
-- Build an import library (.a) from a definition files. An import library
-- is needed to link against a DLL.