Browse Source

* when reading ImpDef records, add '.dll' to the libname if it has no extension,
in order to be consistent with externals, declared in pascal files. The '.dll'
extension will be stripped later, when generating the NewExe file.

git-svn-id: trunk@42615 -

nickysn 6 years ago
parent
commit
1f2354752c
1 changed files with 11 additions and 2 deletions
  1. 11 2
      compiler/ogomf.pas

+ 11 - 2
compiler/ogomf.pas

@@ -615,6 +615,7 @@ interface
       end;
 
     function StripDllExt(const DllName:TSymStr):TSymStr;
+    function MaybeAddDllExt(const DllName:TSymStr):TSymStr;
 
 implementation
 
@@ -2028,9 +2029,9 @@ implementation
         if not CaseSensitiveSymbols then
           SymName:=UpCase(SymName);
         if ImpDefRec.ImportByOrdinal then
-          TOmfObjData(objdata).AddImportSymbol(ImpDefRec.ModuleName,'',SymName,ImpDefRec.Ordinal,false)
+          TOmfObjData(objdata).AddImportSymbol(MaybeAddDllExt(ImpDefRec.ModuleName),'',SymName,ImpDefRec.Ordinal,false)
         else
-          TOmfObjData(objdata).AddImportSymbol(ImpDefRec.ModuleName,ImpDefRec.Name,SymName,0,false);
+          TOmfObjData(objdata).AddImportSymbol(MaybeAddDllExt(ImpDefRec.ModuleName),ImpDefRec.Name,SymName,0,false);
         Result:=True;
         ImpDefRec.Free;
       end;
@@ -4215,6 +4216,14 @@ cleanup:
           Result:=DllName;
       end;
 
+    function MaybeAddDllExt(const DllName: TSymStr): TSymStr;
+      begin
+        if ExtractFileExt(DllName)='' then
+          Result:=ChangeFileExt(DllName,'.dll')
+        else
+          Result:=DllName;
+      end;
+
 {*****************************************************************************
                                   Initialize
 *****************************************************************************}