浏览代码

* variables in dlls need at least a dll name on windows, test fixed
* names of exported functions on windows are not mangled
* cosmetic fixes to tests

git-svn-id: trunk@13422 -

florian 16 年之前
父节点
当前提交
04a796628c
共有 4 个文件被更改,包括 15 次插入7 次删除
  1. 8 1
      compiler/pdecsub.pas
  2. 2 2
      tests/webtbs/tw9089b.pp
  3. 4 4
      tests/webtbs/tw9089c.pp
  4. 1 0
      tests/webtbs/tw9089d.pp

+ 8 - 1
compiler/pdecsub.pas

@@ -2317,7 +2317,14 @@ const
                   if assigned(pd._class) then
                    pd.aliasnames.insert(target_info.Cprefix+pd._class.objrealname^+'_'+pd.procsym.realname)
                   else
-                   pd.aliasnames.insert(target_info.Cprefix+pd.procsym.realname);
+                    begin
+                      { Export names are not mangled on Windows and OS/2, see also pexports.pas }
+                      if (target_info.system in (system_all_windows+[system_i386_emx, system_i386_os2])) and
+                        (po_exports in pd.procoptions) then
+                        pd.aliasnames.insert(pd.procsym.realname)
+                      else
+                        pd.aliasnames.insert(target_info.Cprefix+pd.procsym.realname);
+                    end;
                 end;
               pocall_cppdecl :
                 begin

+ 2 - 2
tests/webtbs/tw9089b.pp

@@ -15,12 +15,12 @@ const
 {$endif}
 
 var
-  myvar: longint; cvar; external;
+  myvar: longint; cvar; external {$ifdef windows}libname{$endif windows};
 
 function Test: Integer; cdecl; export;
 begin
   Result := 0;
-  
+
   Writeln('Test');
 end;
 

+ 4 - 4
tests/webtbs/tw9089c.pp

@@ -3,16 +3,16 @@
 
 program ptest;
 
-{$mode objfpc}{$H+}
+{$ifdef fpc}{$mode objfpc}{$H+}{$endif fpc}
 
 const
-{$ifdef windows}
+{$if defined(windows) or defined(mswindows)}
   libname='tw9089b.dll';
 {$else}
   libname='tw9089a';
   {$linklib tw9089b}
-{$endif}
-  
+{$ifend}
+
 function Test: Integer; cdecl; external libname;
 
 begin

+ 1 - 0
tests/webtbs/tw9089d.pp

@@ -14,4 +14,5 @@ begin
     halt(1);
   close(t);
   erase(t);
+  writeln('ok');
 end.