summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/test/tlibrary1.pp
blob: a564ce13c723b3df0db48fb87a23cd9ea13c6dc4 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{ %NORUN }
{ %SKIPTARGET=macos,go32v2 }

{$ifdef darwin}
{$PIC+}
{$endif darwin}

{$ifdef CPUX86_64}
{$ifndef WINDOWS}
{$PIC+}
{$endif WINDOWS}
{$endif CPUX86_64}

{ The .so of the library needs to be in the current dir when
  testing the loading at runtime }

{$ifdef mswindows}
 {$define supported}
 {$define supportidx}
{$endif win32}
{$ifdef Unix}
 {$define supported}
{$endif Unix}
{$ifndef fpc}
   {$define supported}
{$endif}

{$ifdef supported}

library bug;

const
   publicname='TestName';
   publicindex = 1234;

procedure Test;export;

 begin
   if not islibrary then
     halt(1);
   if not moduleislib then
     halt(2);
   writeln('Hoi');
 end;

exports
  Test name publicname;
{$ifdef supportidx}
exports
  Test index publicindex;
{$endif}

begin
end.
{$else supported}
begin
  Writeln('No library for that target');
end.
{$endif supported}