Root > How to... > ...write code with EurekaLog?

...write code with EurekaLog?

Previous pageReturn to chapter overviewNext page   

We recommend to wrap all EurekaLog-specific code into {$IFDEF EUREKALOG} defines, like so:

 

implementation
 
uses
  Windows,
  {$IFDEF EUREKALOG}
  EEvents, ETypes,
  {$ENDIF}
  SysUtils;
 
{$IFDEF EUREKALOG}

// EurekaLog-specific code
procedure MyExceptionNotifyHandler(const ACustom: Pointer; 
  AExceptionInfo: TEurekaExceptionInfo; 
  var AHandle: Boolean; 
  var ACallNextHandler: Boolean);
begin
  // your code here
end;
{$ENDIF}
 
initialization
  {$IFDEF EUREKALOG}
  RegisterEventExceptionNotify(nil, MyExceptionNotifyHandler);
  {$ENDIF}
end.

 

That way your project may be compiled with or without EurekaLog.

 

The only exception from this rule is the EBase unit and all its routines and types - such as BeginThreadEx, TThread, NameThread, IsEurekaLogActive, SetExceptionMessage, etc. The EBase unit is specifically designed in such a way that it can be used with and without EurekaLog:

 

uses
  Windows,

  EBase,
  {$IFDEF EUREKALOG}
  EEvents, ETypes,
  {$ENDIF}
  SysUtils;

 

For specific code examples, please see:

 

 

See also:




Send feedback... Build date: 2024-12-19
Last edited: 2023-07-18
PRIVACY STATEMENT
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.


Permanent link to this article: https://www.eurekalog.com/help/eurekalog/how_to_write_code_with_eurekalog.php