Преглед изворни кода

+ Check that dll imports in units also works

git-svn-id: trunk@17785 -
pierre пре 14 година
родитељ
комит
3874bc7d74
4 измењених фајлова са 98 додато и 0 уклоњено
  1. 3 0
      .gitattributes
  2. 64 0
      tests/test/library/tlib2b.pp
  3. 16 0
      tests/test/library/ulib2a.pp
  4. 15 0
      tests/test/library/ulib2b.pp

+ 3 - 0
.gitattributes

@@ -9641,6 +9641,9 @@ tests/test/library/testdll2.pp svneol=native#text/plain
 tests/test/library/tlib1a.pp svneol=native#text/plain
 tests/test/library/tlib1a2.pp svneol=native#text/plain
 tests/test/library/tlib1b.pp svneol=native#text/plain
+tests/test/library/tlib2b.pp svneol=native#text/plain
+tests/test/library/ulib2a.pp svneol=native#text/plain
+tests/test/library/ulib2b.pp svneol=native#text/plain
 tests/test/opt/README.txt svneol=native#text/plain
 tests/test/opt/tarmshift.pp svneol=native#text/plain
 tests/test/opt/tcaseopt1.pp svneol=native#text/plain

+ 64 - 0
tests/test/library/tlib2b.pp

@@ -0,0 +1,64 @@
+{ %target=win32,win64,wince }
+{ %needlibrary }
+
+uses
+  ulib2a, ulib2b;
+{ Checks that the two functions with the same exported name 'p'
+  are each loaded correctly. }
+procedure p(var a : dword);external 'tlib1a' name 'p';
+procedure p2(var a : dword);external 'tlib1a2' name 'p';
+
+var
+  a : dword;
+begin
+  a:=0;
+  p(a);
+  if a <> 1 then
+    halt(1);
+  a:=0;
+  p2(a);
+  if a <> 2 then
+    begin
+      if a=1 then
+        writeln('Error: Calling tlib1a library p function again instead ',
+          'of tlib1a2 p function.');
+      halt(2);
+    end;
+
+  ulib2b.p(a);
+  if a <> 1 then
+    halt(1);
+  a:=0;
+  ulib2b.p2(a);
+  if a <> 2 then
+    begin
+      if a=1 then
+        writeln('Error: Calling tlib1a library p function via ulib2b unit again instead ',
+          'of tlib1a2 p function.');
+      halt(2);
+    end;
+
+  ulib2a.p(a);
+  if a <> 1 then
+    halt(1);
+  a:=0;
+  ulib2a.p2(a);
+  if a <> 2 then
+    begin
+      if a=1 then
+        writeln('Error: Calling tlib1a library p function via ulib2a unit again instead ',
+          'of tlib1a2 p function.');
+      halt(2);
+    end;
+
+  ulib2a.p3(a);
+  if a <> 1 then
+    begin
+      if a=1 then
+        writeln('Error: Calling tlib1a library p function via ulib2a unit again instead ',
+          'of tlib1a2 p function.');
+      halt(2);
+    end;
+
+  writeln('ok');
+end.

+ 16 - 0
tests/test/library/ulib2a.pp

@@ -0,0 +1,16 @@
+{ %target=win32,win64,wince }
+{ %needlibrary }
+
+unit
+  ulib2a;
+
+interface
+{ Checks that the two functions with the same exported name 'p'
+  are each loaded correctly. }
+procedure p(var a : dword);external 'tlib1a' name 'p';
+procedure p2(var a : dword);external 'tlib1a2' name 'p';
+procedure p3(var a : dword);external 'tlib1a' name 'p';
+
+implementation
+
+end.

+ 15 - 0
tests/test/library/ulib2b.pp

@@ -0,0 +1,15 @@
+{ %target=win32,win64,wince }
+{ %needlibrary }
+
+unit
+  ulib2b;
+
+interface
+{ Checks that the two functions with the same exported name 'p'
+  are each loaded correctly. }
+procedure p(var a : dword);external 'tlib1a' name 'p';
+procedure p2(var a : dword);external 'tlib1a2' name 'p';
+
+implementation
+
+end.