本文介绍了在Delphi中是否需要使用GUID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

官方文件说它们是可选的。我知道COM interop需要每个接口的唯一标识符,但是我看到的每个接口示例都有一个GUID是否与COM一起使用?是否有任何好处包括一个GUID,如果它不会被用于COM?

解决方案

我注意到一些方法例如(以确定类是否符合特定接口)要求您在使用GUID之前定义GUID。



通过以下信息确认:

这里有一些,其中指出:

以两个引号加重。



阅读整篇文章也让您意识到(需要GUID)在幕后使用,原因如引用计数。


The official documentation says they are optional. I know COM interop requires a unique identifier for each interface but every interface example I see has a GUID whether it's used with COM or not? Is there any benefit to including a GUID if its not going to be used with COM?

解决方案

I've noticed that some methods such as Supports (to determine if a class conforms to a specific interface) require that you define a GUID before you can use them.

This page confirms it with the following information:

Here's some interesting information about interfaces, which states:

Emphasis added in both quotes.

Reading this entire article also makes you realize that QueryInterface (which requires a GUID) is used behind the scenes for reasons such as reference counting.

这篇关于在Delphi中是否需要使用GUID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 05:09