Browse Source

* fix dll linking

git-svn-id: trunk@2464 -
peter 19 years ago
parent
commit
6b536c206a
2 changed files with 9 additions and 4 deletions
  1. 3 3
      compiler/import.pas
  2. 6 1
      compiler/systems/t_win.pas

+ 3 - 3
compiler/import.pas

@@ -32,12 +32,12 @@ uses
 
 
 type
 type
    timported_item = class(TLinkedListItem)
    timported_item = class(TLinkedListItem)
-      ordnr  : word;
+      ordnr  : longint;
       name,
       name,
       func   : pstring;
       func   : pstring;
       lab    : tasmlabel;
       lab    : tasmlabel;
       is_var : boolean;
       is_var : boolean;
-      constructor Create(const n,s : string;o : word);
+      constructor Create(const n,s : string;o : longint);
       constructor Create_var(const n,s : string);
       constructor Create_var(const n,s : string);
       destructor Destroy;override;
       destructor Destroy;override;
    end;
    end;
@@ -98,7 +98,7 @@ uses
                            Timported_item
                            Timported_item
 ****************************************************************************}
 ****************************************************************************}
 
 
-constructor timported_item.Create(const n,s : string;o : word);
+constructor timported_item.Create(const n,s : string;o : longint);
 begin
 begin
   inherited Create;
   inherited Create;
   func:=stringdup(n);
   func:=stringdup(n);

+ 6 - 1
compiler/systems/t_win.pas

@@ -1132,6 +1132,7 @@ var
   i       : longint;
   i       : longint;
   AsBinStr     : string[80];
   AsBinStr     : string[80];
   StripStr,
   StripStr,
+  GCSectionsStr,
   RelocStr,
   RelocStr,
   AppTypeStr,
   AppTypeStr,
   ImageBaseStr : string[40];
   ImageBaseStr : string[40];
@@ -1145,9 +1146,12 @@ begin
   AppTypeStr:='';
   AppTypeStr:='';
   ImageBaseStr:='';
   ImageBaseStr:='';
   StripStr:='';
   StripStr:='';
+  GCSectionsStr:='';
   AsBinStr:=FindUtil(utilsprefix+'as');
   AsBinStr:=FindUtil(utilsprefix+'as');
   if RelocSection then
   if RelocSection then
    RelocStr:='--base-file base.$$$';
    RelocStr:='--base-file base.$$$';
+  if use_smartlink_section then
+   GCSectionsStr:='--gc-sections';
   if apptype=app_gui then
   if apptype=app_gui then
    AppTypeStr:='--subsystem windows';
    AppTypeStr:='--subsystem windows';
   if assigned(DLLImageBase) then
   if assigned(DLLImageBase) then
@@ -1177,6 +1181,7 @@ begin
         Replace(cmdstr,'$RELOC',RelocStr);
         Replace(cmdstr,'$RELOC',RelocStr);
         Replace(cmdstr,'$IMAGEBASE',ImageBaseStr);
         Replace(cmdstr,'$IMAGEBASE',ImageBaseStr);
         Replace(cmdstr,'$STRIP',StripStr);
         Replace(cmdstr,'$STRIP',StripStr);
+        Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
         if not DefFile.Empty then
         if not DefFile.Empty then
           begin
           begin
             DefFile.WriteFile;
             DefFile.WriteFile;
@@ -1619,7 +1624,7 @@ function tDLLScannerWin32.GetEdata(HeaderEntry:cardinal):longbool;
 
 
 function tDLLScannerWin32.scan(const binname:string):longbool;
 function tDLLScannerWin32.scan(const binname:string):longbool;
  var
  var
-  OldFileMode:longint;
+  OldFileMode:byte;
   hs,
   hs,
   foundimp : string;
   foundimp : string;
  begin
  begin