summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw9089b.pp
blob: 8d3ec90667506f37f54f1c7175ab8341e0de03cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{ %target=win32,win64,wince,darwin,linux,freebsd,solaris,beos}
{ %norun }
{ %needlibrary }

library tw9089b;

{$mode objfpc}{$H+}

const
{$ifdef windows}
  libname='tw9089a.dll';
{$else}
  libname='tw9089a';
  {$linklib tw9089a}
{$endif}

var
  myvar: longint; cvar; external {$ifdef windows}libname{$endif windows};

function Test: Integer; cdecl; export;
begin
  Result := 0;

  Writeln('Test');
end;

exports
  Test;

var
  t: text;

initialization
  Writeln('INIT2');
  if (myvar<>-1) then
    halt(3);

finalization
  Writeln('FINI2');
  myvar:=1;
  { so tw9089d can check whether the finalization has run at all }
  assign(t,'tw9089b.txt');
  rewrite(t);
  close(t);
end.