Pergunta

Project based on COM technology. I have logged error by JCL on Delphi XE4 64Bit (SKGeneral64 is COM Dll):

ERR (ThreadID=14C8 14.02.2014 16:43:14:274) - Exception class: _TExitDllException
Exception address: 000000000536DBAE
Stack list, generated 14.02.2014 16:43:14
[000000000536DBAE] System.ExitDll + $3E
[000000000536DCF4] System.@Halt0 + $54
[000000000536D5E3] System.@StartLib + $123
[0000000005375FA2] SysInit.@InitLib + $92
[00000000056D7938] SKGeneral64.SKGeneral64 + $38
[000000007777C76C] Unknown function at RtlUserThreadStart + $26C
[000000007777C42F] Unknown function at LdrInitializeThunk + $10F
[000000007777C32E] LdrInitializeThunk + $E
----------------------------------------------------------------------------------------------------
System   : Windows 7 Professional, Version: 6.1, Build: 1DB1, "Service Pack 1"
Processor: Intel, Intel(R) Xeon(R) CPU           X5670  @ 2.93GHz, 2960 MHz MMX
----------------------------------------------------------------------------------------------------
Module: C:\PROGRA~2\SKBKON~1\Active\Bin\SKGENE~2.DLL   Modified: 14.02.2014 16:42:37
Version: 1.0.0.0  Description: 

What the reason of it? Could it be the cause of the memory leaks and memory fragmentation?

Foi útil?

Solução

Having done a bit of digging around, it seems that this exception is expected and is the way that a thread returns its exit code when the thread terminates.

Here's how it goes. A call is made to System.ExitDll which does this:

procedure ExitDll(Context: PInitContext);
var
  ResultExitCode: Integer;
begin
  Context^ := Context.OuterContext^;
  ResultExitCode := ExitCode;
  ExitCode := 0;
  //raise _TExitDllException.Create(ResultExitCode);
  _RaiseExcept(_TExitDllException.Create(ResultExitCode));
end;

That's what raises the exception. The exception is handled in _HandleExitDllException:

function _HandleExitDllException: Integer;
var
  ExceptionObject: TObject;
begin
  Result := -1;
  ExceptionObject := ExceptObject;
  if ExceptionObject is _TExitDllException then
    Result := _TExitDllException(ExceptionObject).ExitCode
  else
    _UnhandledException;
  _DoneExcept;
end;

This code read the exit code from the exception and returns that value to the caller. You can't see any code in the RTL that calls _HandleExitDllException, presumably because that is linked in magically by the compiler/linker.

Essentially this is a false positive from your error reporting software. This exception is part of normal program execution. There is nothing to worry about. Apart from your error reporting code which seems to deficient.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top