OutputDebugString()与Delphi for MacOS [英] OutputDebugString() with Delphi for MacOS

查看:557
本文介绍了OutputDebugString()与Delphi for MacOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Delphi OSX单元中是否有NSLog声明。我没有在Firemonkey应用程序中找到OutputDebugString的子系统。

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;


推荐答案

在Firemonkey中,事件日志是 Log.d

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

    uses FMX.Types;

    ...

    Log.d('debugging');

我认为这是从 XE3 起。

这篇关于OutputDebugString()与Delphi for MacOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆