* findobjectfile gets extra arg with directory where the unit is found

and the .o should be looked first
This commit is contained in:
peter 2000-07-08 20:43:37 +00:00
parent e43907570a
commit b9e5501ba7
6 changed files with 53 additions and 25 deletions

View File

@ -52,9 +52,9 @@ Type
Constructor Init; Constructor Init;
Destructor Done; Destructor Done;
procedure AddModuleFiles(hp:pmodule); procedure AddModuleFiles(hp:pmodule);
function FindObjectFile(s : string) : string; function FindObjectFile(s : string;const unitpath:string) : string;
function FindLibraryFile(s:string;const ext:string;var found : boolean) : string; function FindLibraryFile(s:string;const ext:string;var found : boolean) : string;
Procedure AddObject(const S : String); Procedure AddObject(const S,unitpath : String);
Procedure AddStaticLibrary(const S : String); Procedure AddStaticLibrary(const S : String);
Procedure AddSharedLibrary(S : String); Procedure AddSharedLibrary(S : String);
Function FindUtil(const s:string):String; Function FindUtil(const s:string):String;
@ -220,7 +220,7 @@ begin
end; end;
{ unit files } { unit files }
while not linkunitofiles.empty do while not linkunitofiles.empty do
AddObject(linkunitofiles.getusemask(mask)); AddObject(linkunitofiles.getusemask(mask),path^);
while not linkunitstaticlibs.empty do while not linkunitstaticlibs.empty do
AddStaticLibrary(linkunitstaticlibs.getusemask(mask)); AddStaticLibrary(linkunitstaticlibs.getusemask(mask));
while not linkunitsharedlibs.empty do while not linkunitsharedlibs.empty do
@ -229,7 +229,7 @@ begin
{ Other needed .o and libs, specified using $L,$LINKLIB,external } { Other needed .o and libs, specified using $L,$LINKLIB,external }
mask:=link_allways; mask:=link_allways;
while not linkotherofiles.empty do while not linkotherofiles.empty do
AddObject(linkotherofiles.Getusemask(mask)); AddObject(linkotherofiles.Getusemask(mask),path^);
while not linkotherstaticlibs.empty do while not linkotherstaticlibs.empty do
AddStaticLibrary(linkotherstaticlibs.Getusemask(mask)); AddStaticLibrary(linkotherstaticlibs.Getusemask(mask));
while not linkothersharedlibs.empty do while not linkothersharedlibs.empty do
@ -260,7 +260,7 @@ end;
{ searches an object file } { searches an object file }
function TLinker.FindObjectFile(s:string) : string; function TLinker.FindObjectFile(s:string;const unitpath:string) : string;
var var
found : boolean; found : boolean;
begin begin
@ -276,13 +276,17 @@ begin
exit; exit;
end; end;
{ find object file { find object file
1. cwd 1. specified unit path (if specified)
2. unit search path 2. cwd
3. local object path 3. unit search path
4. global object path 4. local object path
5. exepath } 5. global object path
6. exepath }
found:=false; found:=false;
findobjectfile:=FindFile(s,'.'+DirSep,found)+s; if unitpath<>'' then
findobjectfile:=FindFile(s,unitpath,found)+s;
if (not found) then
findobjectfile:=FindFile(s,'.'+DirSep,found)+s;
if (not found) then if (not found) then
findobjectfile:=UnitSearchPath.FindFile(s,found)+s; findobjectfile:=UnitSearchPath.FindFile(s,found)+s;
if (not found) then if (not found) then
@ -327,9 +331,9 @@ begin
end; end;
Procedure TLinker.AddObject(const S : String); Procedure TLinker.AddObject(const S,unitpath : String);
begin begin
ObjectFiles.Insert(FindObjectFile(s)); ObjectFiles.Insert(FindObjectFile(s,unitpath));
end; end;
@ -521,7 +525,11 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.89 2000-06-28 03:34:06 hajny Revision 1.90 2000-07-08 20:43:37 peter
* findobjectfile gets extra arg with directory where the unit is found
and the .o should be looked first
Revision 1.89 2000/06/28 03:34:06 hajny
* little corrections for EMX resources * little corrections for EMX resources
Revision 1.88 2000/05/17 18:30:35 peter Revision 1.88 2000/05/17 18:30:35 peter

View File

@ -100,7 +100,7 @@ begin
end; end;
{ add objectfiles, start with prt0 always } { add objectfiles, start with prt0 always }
LinkRes.AddFileName(FindObjectFile('prt0')); LinkRes.AddFileName(FindObjectFile('prt0',''));
while not ObjectFiles.Empty do while not ObjectFiles.Empty do
begin begin
s:=ObjectFiles.Get; s:=ObjectFiles.Get;
@ -190,7 +190,11 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.9 2000-02-28 17:23:57 daniel Revision 1.10 2000-07-08 20:43:38 peter
* findobjectfile gets extra arg with directory where the unit is found
and the .o should be looked first
Revision 1.9 2000/02/28 17:23:57 daniel
* Current work of symtable integration committed. The symtable can be * Current work of symtable integration committed. The symtable can be
activated by defining 'newst', but doesn't compile yet. Changes in type activated by defining 'newst', but doesn't compile yet. Changes in type
checking and oop are completed. What is left is to write a new checking and oop are completed. What is left is to write a new

View File

@ -99,7 +99,7 @@ begin
end; end;
{ add objectfiles, start with prt0 always } { add objectfiles, start with prt0 always }
LinkRes.AddFileName(GetShortName(FindObjectFile('prt0'))); LinkRes.AddFileName(GetShortName(FindObjectFile('prt0','')));
while not ObjectFiles.Empty do while not ObjectFiles.Empty do
begin begin
s:=ObjectFiles.Get; s:=ObjectFiles.Get;
@ -292,7 +292,11 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.10 2000-02-28 17:23:57 daniel Revision 1.11 2000-07-08 20:43:38 peter
* findobjectfile gets extra arg with directory where the unit is found
and the .o should be looked first
Revision 1.10 2000/02/28 17:23:57 daniel
* Current work of symtable integration committed. The symtable can be * Current work of symtable integration committed. The symtable can be
activated by defining 'newst', but doesn't compile yet. Changes in type activated by defining 'newst', but doesn't compile yet. Changes in type
checking and oop are completed. What is left is to write a new checking and oop are completed. What is left is to write a new

View File

@ -312,7 +312,7 @@ begin
LinkRes.Add('INPUT('); LinkRes.Add('INPUT(');
{ add objectfiles, start with prt0 always } { add objectfiles, start with prt0 always }
if prtobj<>'' then if prtobj<>'' then
LinkRes.AddFileName(FindObjectFile(prtobj)); LinkRes.AddFileName(FindObjectFile(prtobj,''));
{ try to add crti and crtbegin if linking to C } { try to add crti and crtbegin if linking to C }
if linklibc then if linklibc then
begin begin
@ -477,7 +477,11 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.14 2000-03-21 21:36:52 peter Revision 1.15 2000-07-08 20:43:38 peter
* findobjectfile gets extra arg with directory where the unit is found
and the .o should be looked first
Revision 1.14 2000/03/21 21:36:52 peter
* only include crtbegin when linking to libc * only include crtbegin when linking to libc
Revision 1.13 2000/03/12 08:24:03 daniel Revision 1.13 2000/03/12 08:24:03 daniel

View File

@ -402,7 +402,7 @@ begin
end; end;
{ add objectfiles, start with prt0 always } { add objectfiles, start with prt0 always }
LinkRes.AddFileName(FindObjectFile('prt0')); LinkRes.AddFileName(FindObjectFile('prt0',''));
while not ObjectFiles.Empty do while not ObjectFiles.Empty do
begin begin
s:=ObjectFiles.Get; s:=ObjectFiles.Get;
@ -507,7 +507,11 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.13 2000-06-28 03:34:06 hajny Revision 1.14 2000-07-08 20:43:38 peter
* findobjectfile gets extra arg with directory where the unit is found
and the .o should be looked first
Revision 1.13 2000/06/28 03:34:06 hajny
* little corrections for EMX resources * little corrections for EMX resources
Revision 1.12 2000/06/25 19:08:28 hajny Revision 1.12 2000/06/25 19:08:28 hajny

View File

@ -689,9 +689,9 @@ begin
{ add objectfiles, start with prt0 always } { add objectfiles, start with prt0 always }
LinkRes.Add('INPUT('); LinkRes.Add('INPUT(');
if isdll then if isdll then
LinkRes.AddFileName(GetShortName(FindObjectFile('wdllprt0'))) LinkRes.AddFileName(GetShortName(FindObjectFile('wdllprt0','')))
else else
LinkRes.AddFileName(GetShortName(FindObjectFile('wprt0'))); LinkRes.AddFileName(GetShortName(FindObjectFile('wprt0','')));
while not ObjectFiles.Empty do while not ObjectFiles.Empty do
begin begin
s:=ObjectFiles.Get; s:=ObjectFiles.Get;
@ -1303,7 +1303,11 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.24 2000-06-20 12:44:30 pierre Revision 1.25 2000-07-08 20:43:38 peter
* findobjectfile gets extra arg with directory where the unit is found
and the .o should be looked first
Revision 1.24 2000/06/20 12:44:30 pierre
* do not create an empty export section * do not create an empty export section
Revision 1.23 2000/05/23 20:18:25 pierre Revision 1.23 2000/05/23 20:18:25 pierre