重新创建 COM DLL,我需要担心 GUID 吗?

发布于 2024-09-16 14:51:21 字数 474 浏览 4 评论 0原文

需要在 DLL 中进行更改。该DLL最初是用VB6编写的(不是我编写的),源代码丢失了。

它的功能非常简单,所以我从头开始重新创建它,但我只能访问 VB Express 2008。

我首先将它创建为普通 DLL,然后意识到它必须是 COM DLL。幸运的是,http://www.codeproject.com/KB/COM/ 上有一篇精彩的文章nettocom.aspx 告诉我如何做。

但是,我对 GUID 一无所知...

我是否应该使用与原始 DLL 相同的 GUID?有什么区别吗?


编辑:既然它是一个 COM DLL,这真的很重要吗?它由 Active X 控件调用我在网页中看不到 GUI 的任何参考...(但我只是一个 n00b,所以我知道什么?;-)

A change needs to be made in a DLL. The DLL was originally coded in VB6 (not by me), and the source code lost.

It is very simple in its functionality, so I recreated it from scratch, but I only have access to VB Express 2008.

I created it first as a normal DLL then realized it had to be a COM DLL. Fortunately, an excellent article at http://www.codeproject.com/KB/COM/nettocom.aspx tells me how.

But, I don't know anything about GUIDs...

Should I use the same GUID as the original DLL or not? Does it make any difference?


Edit: Does it really matter since it's a COM DLL? It is called into by an Active X control & I can see no reference in the web page to the GUI ... (but I'm just a n00b, so what do I know? ;-)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼波传意 2024-09-23 14:51:21

如果您希望这个库直接替换原始库并且它完全二进制兼容(所有接口均不变),那么是的,您应该对类 id 和接口 id 使用相同的 GUID。如果您不这样做,原始库的用户将无法在不重新编译其程序的情况下使用您的库。

请注意,二进制兼容性是重用 GUID 的必要条件。如果你破坏了任何接口 - 更改它的 id 和实现它的类的 id 并重新编译客户端。

If you want this library to be a direct replacement of the original and it is fully binary compatible (all interfaces are unchanged) - then yes, you should use the same GUIDs for the class ids and interface ids. If you don't do that users of the original library will not be able to use yours without recompiling their programs.

Beware that binary compatibility is a must for reusing the GUIDs. If you break any interface - change its id and the id of the class implementing it and recompile the client.

不及他 2024-09-23 14:51:21

GUID 充当 COM 对象和 DLL 的一种标识符。如果您使用相同的 GUID,则需要注册新的 DLL,以便更新位置(即,如果您没有将其完全放在同一位置,并且重新创建了旧 DLL 先前注册的所有接口)。

更简洁的方法是生成一个新的 GUID 并修改调用者以使用新的 GUID/DLL。

The GUIDs acts as a kind of identifier for your COM object and DLL. If you use the same GUID you need to register your new DLL so that the location is updated (i.e. if you don't place it exactly in the same spot and have recreated all interfaces the old DLL previously had registered).

The cleaner approach is to generate a new GUID and modify the caller to use the new GUID/DLL instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文