【问题标题】:OutputDebugString() with Delphi for MacOS用于 MacOS 的 Delphi 的 OutputDebugString()
【发布时间】:2012-09-13 11:41:57
【问题描述】:

Delphi OSX 单元中是否有 NSLog 声明。我未能在 Firemonkey 应用程序中找到 OutputDebugString 的替代品。

最终的解决方案是这样的:

/// <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;

【问题讨论】:

  • 基于this answer,不能像shown here那样在第9点导入NSLog过程吗?这只是一个疯狂的猜测,我与 OSX 完全无关。

标签: delphi delphi-xe2 nslog firemonkey outputdebugstring


【解决方案1】:

在 Firemonkey 中,在事件日志中显示消息的可移植方式是 Log.d

    uses FMX.Types;

    ...

    Log.d('debugging');

我认为它可以从XE3 开始使用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-14
    • 2012-01-12
    相关资源
    最近更新 更多