[fpc-pascal] Exceptions in Library
leledumbo
leledumbo_cool at yahoo.co.id
Mon Mar 30 07:46:46 CEST 2015
> As far as I can tell, exceptions propagate through to the main app -
> (written with Lazarus in this case).
> I would like to trap them directly within the library.
// excp.pas
library excp;
{$mode objfpc}
uses sysutils;
procedure p;
begin
try
raise exception.create('an exception')
except
on e: exception do
writeln(e.message);
end;
end;
exports p;
end.
// test.pas
procedure p; external 'excp';
begin p end.
run with:
$ LD_LIBRARY_PATH=. ./test
you should get:
an exception
tested on ManjaroLinux 64-bit.
--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Exceptions-in-Library-tp5721521p5721522.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
More information about the fpc-pascal
mailing list