简体   繁体   English

我应该在Delphi中使用哪个版本的IMalloc?

[英]Which version of IMalloc should I use in Delphi?

I'm trying to refactor a Delphi 5 project in Delphi XE, to do that I need to fix some errors in a unit called BrowseDr. 我正在尝试在Delphi XE中重构Delphi 5项目,为此我需要在一个名为BrowseDr的单元中修复一些错误。 The error I'm getting is 我得到的错误是

[DCC Error] BrowseDr.pas(1033): E2033 Types of actual and formal var parameters
 must be identical

line 1033:   SHGetMalloc(FShellMalloc);

"MyShlObj": “MyShlObj”:

//SHGetMalloc declaration 
function SHGetMalloc(var ppMalloc: IMalloc): HResult; stdcall;

Now the IMalloc used in the declaration of FShellMalloc is derived from a OLE2.IMalloc while the one used in "MyShlObj" is from ActiveX.IMalloc . 现在,FShellMalloc声明中使用的IMalloc派生自OLE2.IMalloc而“MyShlObj”中使用的IMalloc来自ActiveX.IMalloc

Is it possible alter one of them? 有可能改变其中一个吗? If yes, is it recommended? 如果是的话,是否推荐?

旧版Delphi版本使用OLE2单元,此单元已被ActiveX单元替换,因此现在必须在新项目中使用ActiveX类型。

Check your uses clause. 检查您的使用条款。 A lot of third party code uses compiler directives to load the correct unit. 许多第三方代码使用编译器指令来加载正确的单元。 Changing Compiler version will often result in the wrong file being loaded. 更改编译器版本通常会导致加载错误的文件。

DFS is a classic example. DFS是一个典型的例子。 Go to DFS.INC and ensure an appropriate DFS_COMPILER_xxx is defined. 转到DFS.INC并确保定义了适当的DFS_COMPILER_xxx

The only alteration I think will work is to make sure that FShellMalloc is derived from the same interface as the one used from MyShlObj. 我认为唯一可行的改变是确保FShellMalloc派生自与MyShlObj使用的接口相同的接口。

Modify either one to use the same IMalloc as the other. 修改任一个以使用与另一个相同的IMalloc。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM