OutputDebugString() with Delphi for MacOS

守給你的承諾、 提交于 2019-12-21 17:24:25

问题


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}
  // http://stackoverflow.com/questions/12405447/outputdebugstring-with-delphi-for-macosunit 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;

回答1:


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.



来源:https://stackoverflow.com/questions/12405447/outputdebugstring-with-delphi-for-macos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!