WideString与Delphi 2009中的String相同 [英] Is WideString identical to String in Delphi 2009

查看:161
本文介绍了WideString与Delphi 2009中的String相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在2009年重新编译了一些应用程序,这些应用程序在各种不同的地方使用了扩展。

I'm getting some weird behaviour recompiling some applications in 2009 that used widestrings at various points.

在Delphi 2009 App中,Widestring与String相同?

In a Delphi 2009 App is Widestring identical to String?

推荐答案

否 - WideString基本上是COM BSTR类型的包装器。如果您正在使用COM,则需要它。 Delphi 2009中的String可以保存unicode字符,但与WideString不同。例如,WideStrings不是引用计数,而'string'是。

No - WideString is basically a wrapper for the COM BSTR type. You need it if you're working with COM. "String" in Delphi 2009 can hold unicode characters, but it's NOT the same as WideString. For example, WideStrings aren't reference counted, while 'string' is.

您应该尽可能使用string,只能使用WideString进行COM互操作或处理遗产图书馆。

You should use "string" wherever possible, and only use WideString for COM interop or dealing with legacy libraries.

这篇关于WideString与Delphi 2009中的String相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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