I'm creating an ActiveX server in Delphi to replace a native DLL created in Delphi so that it can be called in .NET. (I'm a Delphi novice and more of a C# guy)
The procedure prototype in the original DLL source is:
procedure Log(Device: byte); StdCall;
Using the design panel in Delphi, I get a .ridl that extends IUnkown of this:
interface IDelphiCom: IUnknown
{
[id(0x00000065)]
HRESULT _stdcall Log([in] byte Device);
};
For the implementation, I have this:
interface
type
TTestCom = class(TTypedComObject, IDelphiCom)
protected
function Log(Device: byte ): HResult; StdCall;
end;
implementation
function TTestCom.Log(Device: byte): HRESULT; StdCall;
begin
result:=0;
end;
I've tried many different combinations of datatype in the .ridl and the implementation, but always get the error message that the Log function is unimplemented:
[dcc32 Error] Unit1.pas(12): E2291 Missing implementation of interface method IDelphiCom.Log
Is there a combination that works, or some other way to solve this? Does anyone have a table that cross-references IUnkown data types to Delphi data types? Is there some kind of add-on for Delphi/Rad Studio like ReSharper that would implement stubs of interface members? I've already figured out several data type conversions, but I'm stuck on simplest - byte.
I found that I need to use unsigned char
in the .ridl and byte
in the implementation. I found the answer here, and more general info about APIs and Delphi here.
User contributions licensed under CC BY-SA 3.0