OutputDebugString() with Delphi for MacOS
Asked Answered
S

1

6

Is there an NSLog declaration in the Delphi OSX units. I failed to find a substitude for OutputDebugString in a Firemonkey application.

The final solution looks like this:

/// <remarks>
/// Output debug string. Output debug string can be seen in Delphi
/// View|Debug Windows|Event Log or with 3-rd party programs such as
/// dbgview.exe from SysInternals (www.sysinternals.com)
/// </remarks>
procedure ODS(const Text: string);
begin
  {$IFDEF MACOS}
  // https://mcmap.net/q/1712003/-outputdebugstring-with-delphi-for-macos unt_Debug;
  Log.d(Text);
  {$ENDIF}
  {$IFDEF LINUX}
  __write(stderr, AText, Length(AText));
  __write(stderr, EOL, Length(EOL));
  {$ENDIF}
  {$IFDEF MSWINDOWS}
  OutputDebugString(PWideChar(Text));
  {$ENDIF}
end;
Slesvig answered 13/9, 2012 at 11:41 Comment(1)
Based on this answer, wouldn't be possible to import the NSLog procedure like shown here at point 9 ? It's just a wild guess, I have absolutely nothing to do with OSX.Orectic
M
8

In Firemonkey, the portable way to display a message in the Event Log is Log.d:

    uses FMX.Types;

    ...

    Log.d('debugging');

I think it is available from XE3 onwards.

Marker answered 7/2, 2015 at 13:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.