My guess would be that either
BorlandIDEServices
itself is not nil but is also not valid anymoreBorlandIDEServices
is valid, but its internalIOTAMessageServices
implementation is not.
Those could account for a read of address 0x00000008
error.
What you should do instead is obtain the IOTAMessageServices
interface earlier in your add-in's lifetime and hold on to it, that way it is still valid in your destructor due to reference counting, eg:
{$IFDEF DEBUG}
private
MsgSvc: IOTAMessageServices;
{$ENDIF}
constructor TMyAddIn.Create;
begin
inherited;
{ ... }
{ initializing stuff }
{ ... }
{$IFDEF DEBUG}
MsgSvc := BorlandIDEServices as IOTAMessageServices;
MsgSvc.AddTitleMessage('Hello');
{$ENDIF}
end;
destructor TMyAddIn.Destroy;
begin
{$IFDEF DEBUG}
MsgSvc.AddTitleMessage('Goodbye');
{$ENDIF}
{ ... }
{ finalizing stuff }
{ ... }
inherited;
end;