View Issue Details

IDProjectCategoryView StatusLast Update
0004605FPCRTLpublic2009-03-21 13:03
ReporterFPC core team Assigned ToJonas Maebe  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionduplicate 
OSWIN32 
Summary0004605: Wrong exceptions handling in DLL
Descriptionusing block try..except for exception handling:
dosn't work in DLL code
see attached program code

Additional InformationReporter: Al Led
EMail: alled at volny dot cz
Tagsdynamic library
Fixed in Revision
FPCOldBugId2573
FPCTarget
Attached Files

Relationships

duplicate of 0012974 resolvedJoost van der Sluis FPC can't catch windows exceptions (av's) in a try/except in a dll call 
related to 0010421 closedJonas Maebe try... block in a Win32 DLL doesn't catch AVs 

Activities

2003-07-14 12:00

 

code.pp (844 bytes)   
{*************** DLL code *****************}

library dll_ex;

uses sysutils;

function DoIt(a,b : double) : double; export; stdcall;
begin
  try
    Result := a / b;
  except
    on e:exception do
    begin
//      Writeln('In DLL:' + E.Message);
      raise Exception.Create('In DLL:' + E.Message);
    end;
  end;

end;

exports
  DoIt name 'DoIt';
end.



{ ******************** Test EXE **************** }

program test_ex;

uses SysUtils;

function TestedFce(a, b : double) : double; stdcall; external 'dll_ex.dll' name 'DoIt';

var
  a : double;
BEGIN
  try
    a := TestedFce(1,0);
  except
    on e:exception do
    begin
      Writeln('In EXE:' + e.Message);
    end;
  end;

END.
code.pp (844 bytes)   

Issue History

Date Modified Username Field Change
2007-12-15 22:19 Florian Relationship added related to 0010421
2008-12-28 10:48 Marco van de Voort Tag Attached: dynamic library
2009-01-13 13:16 Florian Relationship added related to 0012974
2009-01-15 18:06 Jonas Maebe Relationship replaced duplicate of 0012974
2009-01-15 18:06 Jonas Maebe Duplicate ID 0 => 12974
2009-01-15 18:06 Jonas Maebe Status new => resolved
2009-01-15 18:06 Jonas Maebe Resolution open => duplicate
2009-01-15 18:06 Jonas Maebe Assigned To => Jonas Maebe
2009-03-21 13:03 Jonas Maebe Status resolved => closed