summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw14958b.pp
blob: 879c3cdcee0592ed844c9a3fe6c1d2fea22cbdfa (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
{ %target=linux }
{ %needlibrary }
{ %result=182 }
program loadlib;

{$mode objfpc}{$H+}

uses
  dl,dynlibs;

var
  p: Pointer;
  s: Longint;
begin
  Writeln('Opening ', ParamStr(1));
  p := dlopen('./libtw14958a.so', RTLD_LAZY);
  if Assigned(p) then
  begin
    Writeln('OK. Now closing.');
    s := dlclose(p);
    Writeln('After close.');
    if s = 0 then
      begin
        Writeln('Close OK.');
        halt(182);
      end
    else
      Writeln('Failed close. Status: ', s);
  end
  else
    begin
      Writeln('Failed open.');
      halt(1);
    end;
end.