From f959a590fe6bfc820aa48caaa09fea07d34a3a98 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 18 Sep 2001 11:30:47 +0000 Subject: [PATCH] * Fixes win32 linking problems with import libraries * LINKLIB Libraries are now looked for using C file extensions * get_exepath fix --- compiler/assemble.pas | 15 ++- compiler/compiler.pas | 11 +- compiler/globals.pas | 34 +++--- compiler/link.pas | 212 +++++++++++++++++++++------------- compiler/pmodules.pas | 9 +- compiler/scanner.pas | 9 +- compiler/systems.pas | 15 ++- compiler/targets/t_beos.pas | 15 ++- compiler/targets/t_fbsd.pas | 31 +++-- compiler/targets/t_go32v1.pas | 15 ++- compiler/targets/t_go32v2.pas | 15 ++- compiler/targets/t_linux.pas | 39 +++++-- compiler/targets/t_nwm.pas | 15 ++- compiler/targets/t_os2.pas | 15 ++- compiler/targets/t_sunos.pas | 15 ++- compiler/targets/t_win32.pas | 35 +++--- 16 files changed, 336 insertions(+), 164 deletions(-) diff --git a/compiler/assemble.pas b/compiler/assemble.pas index c7c801d917..cb50a9ab13 100644 --- a/compiler/assemble.pas +++ b/compiler/assemble.pas @@ -246,18 +246,18 @@ Implementation begin { the path exists, now we clean only all the .o and .s files } { .o files } - findfirst(s+dirsep+'*'+target_info.objext,anyfile,dir); + findfirst(s+source_info.dirsep+'*'+target_info.objext,anyfile,dir); while (doserror=0) do begin - RemoveFile(s+dirsep+dir.name); + RemoveFile(s+source_info.dirsep+dir.name); findnext(dir); end; findclose(dir); { .s files } - findfirst(s+dirsep+'*'+target_info.asmext,anyfile,dir); + findfirst(s+source_info.dirsep+'*'+target_info.asmext,anyfile,dir); while (doserror=0) do begin - RemoveFile(s+dirsep+dir.name); + RemoveFile(s+source_info.dirsep+dir.name); findnext(dir); end; findclose(dir); @@ -1550,7 +1550,12 @@ Implementation end. { $Log$ - Revision 1.27 2001-09-17 21:29:10 peter + Revision 1.28 2001-09-18 11:30:47 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.27 2001/09/17 21:29:10 peter * merged netbsd, fpu-overflow from fixes branch Revision 1.26 2001/08/30 20:57:09 peter diff --git a/compiler/compiler.pas b/compiler/compiler.pas index 4cefc4f16d..76a687714e 100644 --- a/compiler/compiler.pas +++ b/compiler/compiler.pas @@ -190,6 +190,9 @@ begin DoneCompiler; { inits which need to be done before the arguments are parsed } InitSystems; + { globals depends on source_info so it must be after systems } + InitGlobals; + { verbose depends on exe_path and must be after globals } InitVerbose; {$ifdef BrowserLog} InitBrowserLog; @@ -197,7 +200,6 @@ begin {$ifdef BrowserCol} do_initSymbolInfo; {$endif BrowserCol} - InitGlobals; inittokens; InitSymtable; CompilerInited:=true; @@ -328,7 +330,12 @@ end; end. { $Log$ - Revision 1.21 2001-05-06 14:49:16 peter + Revision 1.22 2001-09-18 11:30:47 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.21 2001/05/06 14:49:16 peter * ppu object to class rewrite * move ppu read and write stuff to fppu diff --git a/compiler/globals.pas b/compiler/globals.pas index e1f78760a7..f792dba1e8 100644 --- a/compiler/globals.pas +++ b/compiler/globals.pas @@ -51,16 +51,6 @@ interface globtype,version,systems; const -{$ifdef unix} - DirSep = '/'; -{$else} - {$ifdef amiga} - DirSep = '/'; - {$else} - DirSep = '\'; - {$endif} -{$endif} - {$ifdef Splitheap} testsplit : boolean = false; {$endif Splitheap} @@ -481,7 +471,7 @@ implementation Function RemoveDir(d:string):boolean; begin - if d[length(d)]=DirSep then + if d[length(d)]=source_info.DirSep then Delete(d,length(d),1); {$I-} rmdir(d); @@ -535,7 +525,7 @@ implementation j:=length(Hstr); while (j>0) and (Hstr[j]<>'.') do begin - if hstr[j]=DirSep then + if hstr[j]=source_info.DirSep then j:=0 else dec(j); @@ -756,17 +746,17 @@ implementation end; { fix pathname } if CurrPath='' then - CurrPath:='.'+DirSep + CurrPath:='.'+source_info.DirSep else begin CurrPath:=FixPath(FExpand(CurrPath),false); if (CurrentDir<>'') and (Copy(CurrPath,1,length(CurrentDir))=CurrentDir) then - CurrPath:='.'+DirSep+Copy(CurrPath,length(CurrentDir)+1,255); + CurrPath:='.'+source_info.DirSep+Copy(CurrPath,length(CurrentDir)+1,255); end; { wildcard adding ? } if pos('*',currpath)>0 then begin - if currpath[length(currpath)]=dirsep then + if currpath[length(currpath)]=source_info.dirsep then hs:=Copy(currpath,1,length(CurrPath)-1) else hs:=currpath; @@ -778,7 +768,7 @@ implementation (dir.name<>'..') and ((dir.attr and directory)<>0) then begin - currpath:=hsd+dir.name+dirsep; + currpath:=hsd+dir.name+source_info.dirsep; hp:=Find(currPath); if not assigned(hp) then AddCurrPath; @@ -1318,6 +1308,8 @@ implementation procedure InitGlobals; begin + get_exepath; + { set global switches } do_build:=false; do_release:=false; @@ -1390,9 +1382,8 @@ implementation apptype:=app_cui; end; -begin - get_exepath; {$ifdef EXTDEBUG} +begin {$ifdef FPC} EntryMemUsed:=system.HeapSize-MemAvail; {$endif FPC} @@ -1400,7 +1391,12 @@ begin end. { $Log$ - Revision 1.42 2001-09-17 21:29:11 peter + Revision 1.43 2001-09-18 11:30:47 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.42 2001/09/17 21:29:11 peter * merged netbsd, fpu-overflow from fixes branch Revision 1.41 2001/08/19 11:22:22 peter diff --git a/compiler/link.pas b/compiler/link.pas index 896d2349bf..87f28b0372 100644 --- a/compiler/link.pas +++ b/compiler/link.pas @@ -57,11 +57,11 @@ Type Constructor Create;virtual; Destructor Destroy;override; procedure AddModuleFiles(hp:tmodule); - function FindObjectFile(s : string;const unitpath:string) : string; - function FindLibraryFile(s:string;const ext:string;var found : boolean) : string; Procedure AddObject(const S,unitpath : String); Procedure AddStaticLibrary(const S : String); Procedure AddSharedLibrary(S : String); + Procedure AddStaticCLibrary(const S : String); + Procedure AddSharedCLibrary(S : String); Function FindUtil(const s:string):String; Function DoExec(const command,para:string;showinfo,useshell:boolean):boolean; { Virtuals } @@ -77,6 +77,9 @@ var CLinker : array[tld] of TLinkerClass; Linker : TLinker; +function FindObjectFile(s : string;const unitpath:string) : string; +function FindLibraryFile(s:string;const prefix,ext:string;var foundfile : string) : boolean; + procedure RegisterLinker(t:tld;c:TLinkerClass); procedure InitLinker; procedure DoneLinker; @@ -94,6 +97,92 @@ uses script,globals,verbose,ppu; +{***************************************************************************** + Helpers +*****************************************************************************} + +{ searches an object file } +function FindObjectFile(s:string;const unitpath:string) : string; +var + found : boolean; + foundfile : string; + s1 : string; +begin + findobjectfile:=''; + if s='' then + exit; + if pos('.',s)=0 then + s:=s+target_info.objext; + s1:=FixFileName(s); + if FileExists(s1) then + begin + Findobjectfile:=ScriptFixFileName(s); + exit; + end; + { find object file + 1. specified unit path (if specified) + 2. cwd + 3. unit search path + 4. local object path + 5. global object path + 6. exepath } + found:=false; + if unitpath<>'' then + found:=FindFile(s,unitpath,foundfile); + if (not found) then + found:=FindFile(s,'.'+source_info.DirSep,foundfile); + if (not found) then + found:=UnitSearchPath.FindFile(s,foundfile); + if (not found) then + found:=current_module.localobjectsearchpath.FindFile(s,foundfile); + if (not found) then + found:=objectsearchpath.FindFile(s,foundfile); + if (not found) then + found:=FindFile(s,exepath,foundfile); + if not(cs_link_extern in aktglobalswitches) and (not found) then + Message1(exec_w_objfile_not_found,s); + findobjectfile:=ScriptFixFileName(foundfile); +end; + + +{ searches an library file } +function FindLibraryFile(s:string;const prefix,ext:string;var foundfile : string) : boolean; +var + found : boolean; +begin + findlibraryfile:=false; + foundfile:=s; + if s='' then + exit; + { add prefix 'lib' } + if (prefix<>'') and (Copy(s,1,length(prefix))<>prefix) then + s:=prefix+s; + { add extension } + if (ext<>'') and (Copy(s,length(s)-length(ext)+1,length(ext))<>ext) then + s:=s+ext; + if FileExists(s) then + begin + foundfile:=ScriptFixFileName(s); + FindLibraryFile:=true; + exit; + end; + { find libary + 1. cwd + 2. local libary dir + 3. global libary dir + 4. exe path of the compiler } + found:=FindFile(s,'.'+source_info.DirSep,foundfile); + if (not found) then + found:=current_module.locallibrarysearchpath.FindFile(s,foundfile); + if (not found) then + found:=librarysearchpath.FindFile(s,foundfile); + if (not found) then + found:=FindFile(s,exepath,foundfile); + foundfile:=ScriptFixFileName(foundfile); + findlibraryfile:=found; +end; + + {***************************************************************************** TLINKER *****************************************************************************} @@ -208,9 +297,9 @@ begin while not linkotherofiles.empty do AddObject(linkotherofiles.Getusemask(mask),path^); while not linkotherstaticlibs.empty do - AddStaticLibrary(linkotherstaticlibs.Getusemask(mask)); + AddStaticCLibrary(linkotherstaticlibs.Getusemask(mask)); while not linkothersharedlibs.empty do - AddSharedLibrary(linkothersharedlibs.Getusemask(mask)); + AddSharedCLibrary(linkothersharedlibs.Getusemask(mask)); end; end; @@ -245,83 +334,6 @@ begin end; -{ searches an object file } -function TLinker.FindObjectFile(s:string;const unitpath:string) : string; -var - found : boolean; - foundfile : string; - s1 : string; -begin - findobjectfile:=''; - if s='' then - exit; - if pos('.',s)=0 then - s:=s+target_info.objext; - s1:=FixFileName(s); - if FileExists(s1) then - begin - Findobjectfile:=ScriptFixFileName(s); - exit; - end; - { find object file - 1. specified unit path (if specified) - 2. cwd - 3. unit search path - 4. local object path - 5. global object path - 6. exepath } - found:=false; - if unitpath<>'' then - found:=FindFile(s,unitpath,foundfile); - if (not found) then - found:=FindFile(s,'.'+DirSep,foundfile); - if (not found) then - found:=UnitSearchPath.FindFile(s,foundfile); - if (not found) then - found:=current_module.localobjectsearchpath.FindFile(s,foundfile); - if (not found) then - found:=objectsearchpath.FindFile(s,foundfile); - if (not found) then - found:=FindFile(s,exepath,foundfile); - if not(cs_link_extern in aktglobalswitches) and (not found) then - Message1(exec_w_objfile_not_found,s); - findobjectfile:=ScriptFixFileName(foundfile); -end; - - -{ searches an library file } -function TLinker.FindLibraryFile(s:string;const ext:string;var found : boolean) : string; -var - foundfile : string; -begin - found:=false; - findlibraryfile:=''; - if s='' then - exit; - if pos('.',s)=0 then - s:=s+ext; - if FileExists(s) then - begin - found:=true; - FindLibraryFile:=ScriptFixFileName(s); - exit; - end; - { find libary - 1. cwd - 2. local libary dir - 3. global libary dir - 4. exe path of the compiler } - found:=FindFile(s,'.'+DirSep,foundfile); - if (not found) then - found:=current_module.locallibrarysearchpath.FindFile(s,foundfile); - if (not found) then - found:=librarysearchpath.FindFile(s,foundfile); - if (not found) then - found:=FindFile(s,exepath,foundfile); - findlibraryfile:=ScriptFixFileName(foundfile); -end; - - Procedure TLinker.AddObject(const S,unitpath : String); begin ObjectFiles.Concat(FindObjectFile(s,unitpath)); @@ -350,7 +362,36 @@ var begin if s='' then exit; - ns:=FindLibraryFile(s,target_info.staticlibext,found); + found:=FindLibraryFile(s,target_info.staticlibprefix,target_info.staticlibext,ns); + if not(cs_link_extern in aktglobalswitches) and (not found) then + Message1(exec_w_libfile_not_found,s); + StaticLibFiles.Concat(ns); +end; + + +Procedure TLinker.AddSharedCLibrary(S:String); +begin + if s='' then + exit; +{ remove prefix 'lib' } + if Copy(s,1,length(target_info.sharedclibprefix))=target_info.sharedclibprefix then + Delete(s,1,length(target_info.sharedclibprefix)); +{ remove extension if any } + if Copy(s,length(s)-length(target_info.sharedclibext)+1,length(target_info.sharedclibext))=target_info.sharedclibext then + Delete(s,length(s)-length(target_info.sharedclibext)+1,length(target_info.sharedclibext)+1); +{ ready to be added } + SharedLibFiles.Concat(S); +end; + + +Procedure TLinker.AddStaticCLibrary(const S:String); +var + ns : string; + found : boolean; +begin + if s='' then + exit; + found:=FindLibraryFile(s,target_info.staticclibprefix,target_info.staticclibext,ns); if not(cs_link_extern in aktglobalswitches) and (not found) then Message1(exec_w_libfile_not_found,s); StaticLibFiles.Concat(ns); @@ -492,7 +533,12 @@ initialization end. { $Log$ - Revision 1.23 2001-09-17 21:29:11 peter + Revision 1.24 2001-09-18 11:30:48 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.23 2001/09/17 21:29:11 peter * merged netbsd, fpu-overflow from fixes branch Revision 1.22 2001/08/30 20:13:53 peter diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index 473ea4d3a3..1a2d1ef723 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -69,7 +69,7 @@ implementation begin S:=current_module.linkOtherSharedLibs.Getusemask(link_allways); if not DLLScanner.scan(s) then - KeepShared.Insert(s); + KeepShared.Concat(s); end; DLLscanner.Free; { Recreate import section } @@ -1339,7 +1339,12 @@ implementation end. { $Log$ - Revision 1.46 2001-09-13 14:47:47 michael + Revision 1.47 2001-09-18 11:30:48 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.46 2001/09/13 14:47:47 michael + Committed patch from peter Revision 1.45 2001/08/26 13:36:46 florian diff --git a/compiler/scanner.pas b/compiler/scanner.pas index 12e3f04b96..d695c0b6a8 100644 --- a/compiler/scanner.pas +++ b/compiler/scanner.pas @@ -669,7 +669,7 @@ implementation end else path:=current_scanner.inputfile.path^; - found:=FindFile(name+ext,path+';.'+DirSep,foundfile); + found:=FindFile(name+ext,path+';.'+source_info.DirSep,foundfile); if (not found) then found:=current_module.localincludesearchpath.FindFile(name+ext,foundfile); if (not found) then @@ -2602,7 +2602,12 @@ exit_label: end. { $Log$ - Revision 1.21 2001-07-30 20:59:27 peter + Revision 1.22 2001-09-18 11:30:48 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.21 2001/07/30 20:59:27 peter * m68k updates from v10 merged Revision 1.20 2001/07/15 11:56:21 peter diff --git a/compiler/systems.pas b/compiler/systems.pas index b514c8d9dc..416bdd3fc4 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -171,8 +171,6 @@ interface cpu : ttargetcpu; unit_env : string[12]; extradefines : string[40]; - sharedlibext : string[10]; - staticlibext, sourceext, pasext, exeext, @@ -185,8 +183,14 @@ interface objext, resext, resobjext : string[4]; + sharedlibext : string[10]; + staticlibext, staticlibprefix : string[4]; sharedlibprefix : string[4]; + sharedClibext : string[10]; + staticClibext, + staticClibprefix : string[4]; + sharedClibprefix : string[4]; Cprefix : string[2]; newline : string[2]; dirsep : char; @@ -647,7 +651,12 @@ finalization end. { $Log$ - Revision 1.26 2001-09-17 21:29:13 peter + Revision 1.27 2001-09-18 11:30:48 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.26 2001/09/17 21:29:13 peter * merged netbsd, fpu-overflow from fixes branch Revision 1.25 2001/08/30 20:57:10 peter diff --git a/compiler/targets/t_beos.pas b/compiler/targets/t_beos.pas index c4fe82a293..1c0b57cc94 100644 --- a/compiler/targets/t_beos.pas +++ b/compiler/targets/t_beos.pas @@ -448,8 +448,6 @@ end; cpu : i386; unit_env : 'BEOSUNITS'; extradefines : ''; - sharedlibext : '.so'; - staticlibext : '.a'; sourceext : '.pp'; pasext : '.pas'; exeext : ''; @@ -462,8 +460,14 @@ end; objext : '.o'; resext : '.res'; resobjext : '.or'; + sharedlibext : '.so'; + staticlibext : '.a'; staticlibprefix : 'libp'; sharedlibprefix : 'lib'; + sharedClibext : '.so'; + staticClibext : '.a'; + staticClibprefix : 'lib'; + sharedClibprefix : 'lib'; Cprefix : ''; newline : #10; dirsep : '/'; @@ -513,7 +517,12 @@ initialization end. { $Log$ - Revision 1.7 2001-09-17 21:29:15 peter + Revision 1.8 2001-09-18 11:32:00 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.7 2001/09/17 21:29:15 peter * merged netbsd, fpu-overflow from fixes branch Revision 1.6 2001/08/12 17:57:07 peter diff --git a/compiler/targets/t_fbsd.pas b/compiler/targets/t_fbsd.pas index a6d3095766..b6321802fa 100644 --- a/compiler/targets/t_fbsd.pas +++ b/compiler/targets/t_fbsd.pas @@ -495,8 +495,6 @@ end; cpu : i386; unit_env : 'BSDUNITS'; extradefines : 'UNIX;BSD'; - sharedlibext : '.so'; - staticlibext : '.a'; sourceext : '.pp'; pasext : '.pas'; exeext : ''; @@ -509,8 +507,14 @@ end; objext : '.o'; resext : '.res'; resobjext : '.or'; + sharedlibext : '.so'; + staticlibext : '.a'; staticlibprefix : 'libp'; sharedlibprefix : 'lib'; + sharedClibext : '.so'; + staticClibext : '.a'; + staticClibprefix : 'lib'; + sharedClibprefix : 'lib'; Cprefix : ''; newline : #10; dirsep : '/'; @@ -558,8 +562,6 @@ end; cpu : i386; unit_env : 'BSDUNITS'; extradefines : 'UNIX;BSD'; - sharedlibext : '.so'; - staticlibext : '.a'; sourceext : '.pp'; pasext : '.pas'; exeext : ''; @@ -572,8 +574,14 @@ end; objext : '.o'; resext : '.res'; resobjext : '.or'; + sharedlibext : '.so'; + staticlibext : '.a'; staticlibprefix : 'libp'; sharedlibprefix : 'lib'; + sharedClibext : '.so'; + staticClibext : '.a'; + staticClibprefix : 'lib'; + sharedClibprefix : 'lib'; Cprefix : '_'; newline : #10; dirsep : '/'; @@ -624,8 +632,6 @@ end; cpu : i386; unit_env : 'BSDUNITS'; extradefines : 'UNIX;BSD'; - sharedlibext : '.so'; - staticlibext : '.a'; sourceext : '.pp'; pasext : '.pas'; exeext : ''; @@ -638,8 +644,14 @@ end; objext : '.o'; resext : '.res'; resobjext : '.or'; + sharedlibext : '.so'; + staticlibext : '.a'; staticlibprefix : 'libp'; sharedlibprefix : 'lib'; + sharedClibext : '.so'; + staticClibext : '.a'; + staticClibprefix : 'lib'; + sharedClibprefix : 'lib'; Cprefix : ''; newline : #10; dirsep : '/'; @@ -698,7 +710,12 @@ initialization end. { $Log$ - Revision 1.11 2001-09-17 21:29:16 peter + Revision 1.12 2001-09-18 11:32:00 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.11 2001/09/17 21:29:16 peter * merged netbsd, fpu-overflow from fixes branch Revision 1.10 2001/08/12 17:57:07 peter diff --git a/compiler/targets/t_go32v1.pas b/compiler/targets/t_go32v1.pas index dd89d523a6..69411f58a5 100644 --- a/compiler/targets/t_go32v1.pas +++ b/compiler/targets/t_go32v1.pas @@ -201,8 +201,6 @@ end; cpu : i386; unit_env : 'GO32V1UNITS'; extradefines : 'DPMI'; - sharedlibext : '.dll'; - staticlibext : '.a'; sourceext : '.pp'; pasext : '.pas'; exeext : ''; { No .exe, the linker only output a.out ! } @@ -215,8 +213,14 @@ end; objext : '.o1'; resext : '.res'; resobjext : '.o1r'; + sharedlibext : '.dll'; + staticlibext : '.a'; staticlibprefix : ''; sharedlibprefix : ''; + sharedClibext : '.dll'; + staticClibext : '.a'; + staticClibprefix : ''; + sharedClibprefix : ''; Cprefix : '_'; newline : #13#10; dirsep : '\'; @@ -262,7 +266,12 @@ initialization end. { $Log$ - Revision 1.10 2001-09-17 21:29:16 peter + Revision 1.11 2001-09-18 11:32:00 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.10 2001/09/17 21:29:16 peter * merged netbsd, fpu-overflow from fixes branch Revision 1.9 2001/08/19 11:22:24 peter diff --git a/compiler/targets/t_go32v2.pas b/compiler/targets/t_go32v2.pas index f20e8ee822..ca2d5f4156 100644 --- a/compiler/targets/t_go32v2.pas +++ b/compiler/targets/t_go32v2.pas @@ -365,8 +365,6 @@ end; cpu : i386; unit_env : 'GO32V2UNITS'; extradefines : 'DPMI'; - sharedlibext : '.dll'; - staticlibext : '.a'; sourceext : '.pp'; pasext : '.pas'; exeext : '.exe'; @@ -379,8 +377,14 @@ end; objext : '.o'; resext : '.res'; resobjext : '.or'; + sharedlibext : '.dll'; + staticlibext : '.a'; staticlibprefix : ''; sharedlibprefix : ''; + sharedClibext : '.dll'; + staticClibext : '.a'; + staticClibprefix : ''; + sharedClibprefix : ''; Cprefix : '_'; newline : #13#10; dirsep : '\'; @@ -426,7 +430,12 @@ initialization end. { $Log$ - Revision 1.13 2001-09-17 21:29:16 peter + Revision 1.14 2001-09-18 11:32:00 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.13 2001/09/17 21:29:16 peter * merged netbsd, fpu-overflow from fixes branch Revision 1.12 2001/08/30 20:08:23 peter diff --git a/compiler/targets/t_linux.pas b/compiler/targets/t_linux.pas index 96c330ed4e..5ca9cc7972 100644 --- a/compiler/targets/t_linux.pas +++ b/compiler/targets/t_linux.pas @@ -485,8 +485,6 @@ end; cpu : i386; unit_env : 'LINUXUNITS'; extradefines : 'UNIX'; - sharedlibext : '.so'; - staticlibext : '.a'; sourceext : '.pp'; pasext : '.pas'; exeext : ''; @@ -499,8 +497,14 @@ end; objext : '.o'; resext : '.res'; resobjext : '.or'; + sharedlibext : '.so'; + staticlibext : '.a'; staticlibprefix : 'libp'; sharedlibprefix : 'lib'; + sharedClibext : '.so'; + staticClibext : '.a'; + staticClibprefix : 'lib'; + sharedClibprefix : 'lib'; Cprefix : ''; newline : #10; dirsep : '/'; @@ -551,8 +555,6 @@ end; short_name : 'LINUX'; unit_env : 'LINUXUNITS'; extradefines : 'UNIX'; - sharedlibext : '.so'; - staticlibext : '.a'; sourceext : '.pp'; pasext : '.pas'; exeext : ''; @@ -565,8 +567,14 @@ end; objext : '.o'; resext : '.res'; resobjext : '.or'; + sharedlibext : '.so'; + staticlibext : '.a'; staticlibprefix : 'libp'; sharedlibprefix : 'lib'; + sharedClibext : '.so'; + staticClibext : '.a'; + staticClibprefix : 'lib'; + sharedClibprefix : 'lib'; Cprefix : ''; newline : #10; dirsep : '/'; @@ -603,8 +611,6 @@ end; short_name : 'LINUX'; unit_env : ''; extradefines : 'UNIX'; - sharedlibext : '.so'; - staticlibext : '.s'; sourceext : '.pp'; pasext : '.pas'; exeext : ''; @@ -617,8 +623,14 @@ end; objext : '.o'; resext : '.res'; resobjext : '.or'; + sharedlibext : '.so'; + staticlibext : '.s'; staticlibprefix : 'libp'; sharedlibprefix : 'lib'; + sharedClibext : '.so'; + staticClibext : '.a'; + staticClibprefix : 'lib'; + sharedClibprefix : 'lib'; Cprefix : ''; newline : #10; dirsep : '/'; @@ -653,8 +665,6 @@ end; short_name : 'LINUX'; unit_env : 'LINUXUNITS'; extradefines : 'UNIX'; - sharedlibext : '.so'; - staticlibext : '.a'; sourceext : '.pp'; pasext : '.pas'; exeext : ''; @@ -667,8 +677,14 @@ end; objext : '.o'; resext : '.res'; resobjext : '.or'; + sharedlibext : '.so'; + staticlibext : '.a'; staticlibprefix : 'libp'; sharedlibprefix : 'lib'; + sharedClibext : '.so'; + staticClibext : '.a'; + staticClibprefix : 'lib'; + sharedClibprefix : 'lib'; Cprefix : ''; newline : #10; dirsep : '/'; @@ -723,7 +739,12 @@ initialization end. { $Log$ - Revision 1.12 2001-09-17 21:29:16 peter + Revision 1.13 2001-09-18 11:32:00 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.12 2001/09/17 21:29:16 peter * merged netbsd, fpu-overflow from fixes branch Revision 1.11 2001/08/07 18:47:15 peter diff --git a/compiler/targets/t_nwm.pas b/compiler/targets/t_nwm.pas index 2b6d08ff5b..364c929d32 100644 --- a/compiler/targets/t_nwm.pas +++ b/compiler/targets/t_nwm.pas @@ -465,8 +465,6 @@ end; cpu : i386; unit_env : 'NETWAREUNITS'; extradefines : ''; - sharedlibext : '.nlm'; - staticlibext : '.a'; sourceext : '.pp'; pasext : '.pas'; exeext : '.nlm'; @@ -479,8 +477,14 @@ end; objext : '.on'; resext : '.res'; resobjext : '.or'; + sharedlibext : '.nlm'; + staticlibext : '.a'; staticlibprefix : ''; sharedlibprefix : ''; + sharedClibext : '.nlm'; + staticClibext : '.a'; + staticClibprefix : ''; + sharedClibprefix : ''; Cprefix : ''; newline : #13#10; dirsep : '\'; @@ -528,7 +532,12 @@ initialization end. { $Log$ - Revision 1.10 2001-09-17 21:29:16 peter + Revision 1.11 2001-09-18 11:32:00 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.10 2001/09/17 21:29:16 peter * merged netbsd, fpu-overflow from fixes branch Revision 1.9 2001/08/07 18:47:15 peter diff --git a/compiler/targets/t_os2.pas b/compiler/targets/t_os2.pas index f84f206c0d..b89f242492 100644 --- a/compiler/targets/t_os2.pas +++ b/compiler/targets/t_os2.pas @@ -523,8 +523,6 @@ end; cpu : i386; unit_env : 'OS2UNITS'; extradefines : ''; - sharedlibext : '.ao2'; - staticlibext : '.ao2'; sourceext : '.pas'; pasext : '.pp'; exeext : '.exe'; @@ -537,8 +535,14 @@ end; objext : '.oo2'; resext : '.res'; resobjext : '.oor'; + sharedlibext : '.ao2'; + staticlibext : '.ao2'; staticlibprefix : ''; sharedlibprefix : ''; + sharedClibext : 'dll'; + staticClibext : '.a'; + staticClibprefix : ''; + sharedClibprefix : ''; Cprefix : '_'; newline : #13#10; dirsep : '\'; @@ -586,7 +590,12 @@ initialization end. { $Log$ - Revision 1.10 2001-09-17 21:29:16 peter + Revision 1.11 2001-09-18 11:32:00 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.10 2001/09/17 21:29:16 peter * merged netbsd, fpu-overflow from fixes branch Revision 1.9 2001/08/07 18:47:15 peter diff --git a/compiler/targets/t_sunos.pas b/compiler/targets/t_sunos.pas index be82241e55..e536c4480b 100644 --- a/compiler/targets/t_sunos.pas +++ b/compiler/targets/t_sunos.pas @@ -488,8 +488,6 @@ end; cpu : i386; unit_env : 'SUNOSUNITS'; extradefines : 'UNIX;SOLARIS;LIBC'; - sharedlibext : '.so'; - staticlibext : '.a'; sourceext : '.pp'; pasext : '.pas'; exeext : ''; @@ -502,8 +500,14 @@ end; objext : '.o'; resext : '.res'; resobjext : '.or'; + sharedlibext : '.so'; + staticlibext : '.a'; staticlibprefix : 'libp'; sharedlibprefix : 'lib'; + sharedClibext : '.so'; + staticClibext : '.a'; + staticClibprefix : 'lib'; + sharedClibprefix : 'lib'; Cprefix : ''; newline : #10; dirsep : '/'; @@ -551,7 +555,12 @@ initialization end. { $Log$ - Revision 1.11 2001-09-17 21:29:16 peter + Revision 1.12 2001-09-18 11:32:00 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.11 2001/09/17 21:29:16 peter * merged netbsd, fpu-overflow from fixes branch Revision 1.10 2001/08/12 17:57:07 peter diff --git a/compiler/targets/t_win32.pas b/compiler/targets/t_win32.pas index 8f2e807de5..2136125abb 100644 --- a/compiler/targets/t_win32.pas +++ b/compiler/targets/t_win32.pas @@ -787,15 +787,7 @@ begin While not SharedLibFiles.Empty do begin S:=SharedLibFiles.GetFirst; - if pos('.',s)=0 then - { we never directly link a DLL - its allways through an import library PM } - { libraries created by C compilers have .a extensions } - s2:=s+'.a'{ target_os.sharedlibext } - else - s2:=s; - s2:=FindLibraryFile(s2,'',found); - if found then + if FindLibraryFile(s,target_info.staticClibprefix,target_info.staticClibext,s2) then begin LinkRes.Add(GetShortName(s2)); continue; @@ -1222,13 +1214,13 @@ end; 1. Current dir 2. Library Path 3. windir,windir/system,windir/system32 } - Found:=FindFile(s,'.'+DirSep,founddll); + Found:=FindFile(s,'.'+source_info.DirSep,founddll); if (not found) then Found:=librarysearchpath.FindFile(s,founddll); if (not found) then begin sysdir:=FixPath(GetEnv('windir'),false); - Found:=FindFile(s,sysdir+';'+sysdir+'system'+DirSep+';'+sysdir+'system32'+DirSep,founddll); + Found:=FindFile(s,sysdir+';'+sysdir+'system'+source_info.DirSep+';'+sysdir+'system32'+source_info.DirSep,founddll); end; if (not found) then begin @@ -1411,10 +1403,16 @@ function tDLLScannerWin32.GetEdata(HeaderEntry:cardinal):longbool; function tDLLScannerWin32.scan(const binname:string):longbool; var OldFileMode:longint; + foundimp : string; begin Scan:=false; + { is there already an import library the we will use that one } + if FindLibraryFile(binname,target_info.staticClibprefix,target_info.staticClibext,foundimp) then + exit; + { check if we can find the dll } if not FindDll(DLLName(binname),impname) then exit; + { read the dll file } assign(f,impname); OldFileMode:=filemode; filemode:=0; @@ -1459,8 +1457,6 @@ function tDLLScannerWin32.scan(const binname:string):longbool; cpu : i386; unit_env : 'WIN32UNITS'; extradefines : 'MSWINDOWS'; - sharedlibext : '.dll'; - staticlibext : '.aw'; sourceext : '.pp'; pasext : '.pas'; exeext : '.exe'; @@ -1473,8 +1469,14 @@ function tDLLScannerWin32.scan(const binname:string):longbool; objext : '.ow'; resext : '.rc'; resobjext : '.owr'; + sharedlibext : '.dll'; + staticlibext : '.aw'; staticlibprefix : 'libp'; sharedlibprefix : ''; + sharedClibext : '.dll'; + staticClibext : '.a'; + staticClibprefix : 'lib'; + sharedClibprefix : ''; Cprefix : '_'; newline : #13#10; dirsep : '\'; @@ -1525,7 +1527,12 @@ initialization end. { $Log$ - Revision 1.17 2001-09-17 21:29:16 peter + Revision 1.18 2001-09-18 11:32:00 michael + * Fixes win32 linking problems with import libraries + * LINKLIB Libraries are now looked for using C file extensions + * get_exepath fix + + Revision 1.17 2001/09/17 21:29:16 peter * merged netbsd, fpu-overflow from fixes branch Revision 1.16 2001/09/13 14:47:19 michael