Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 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":

//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.

Is it possible alter one of them? If yes, is it recommended?

like image 405
Roise Avatar asked Jan 20 '23 16:01

Roise


2 Answers

The OLE2 unit was used by older Delphi versions, this unit was replaced by the ActiveX unit, so now you must use the ActiveX types in your new project.

like image 80
RRUZ Avatar answered Jan 28 '23 17:01

RRUZ


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.

Modify either one to use the same IMalloc as the other.

like image 40
Kaos Avatar answered Jan 28 '23 16:01

Kaos