There is a task to write a COM server output it needs to be a string.
Here is the interface in the _TLB.pas file
// *********************************************************************//
// Interface: ITMyCOM
// Flags: (256) OleAutomation
// GUID: {D94769D0-F4AF-41E9-9111-4D8BC2F42D69}
// *********************************************************************//
ITMyCOM = interface(IUnknown)
['{D94769D0-F4AF-41E9-9111-4D8BC2F42D69}']
MyDrawWS function(a: Integer; b: Integer): WideString; stdcall;
end;
This is how it looks in Axis Windows
[
odl
uuid(D94769D0-F4AF-41E9-9111-4D8BC2F42D69),
version(1.0),
helpstring("Interface for TMyCOM Object")
oleautomation
]
ITMyCOM interface : IUnknown {
BSTR _stdcall MyDrawWS(
[in] long a,
[in] long b);
};
ie WideString and BSTR is how the idea should be.
The function in the COM server are as follows
function TTMyCOM.MyDrawWS(a, b: Integer): WideString;
begin
Result := WideString(IntToStr(a+b));
end;
Call it as follows
Edit1.Text := String(MyCOM.MyDrawWS(1,1));
and get the error
First chance exception at $75A9FBAE. Exception class EAccessViolation with message 'Access violation at address in module 75A409A4 'RPCRT4.dll'. Read of address FFFFFFF8'. Process Project1.exe (2296)The return numbers are working fine. Already tried different ways to translate from type to type, but nothing happens.