fpc/tests/webtbs/tw14958b.pp
2009-11-15 13:50:14 +00:00

37 lines
569 B
ObjectPascal

{ %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.