I've used midl to convert a .idl file to a .tlb. When I import this .tlb file into Delphi (XE7), it converts this Write function which is part of
interface IWTSVirtualChannel : IUnknown
...
HRESULT Write(
[in] ULONG cbSize,
[in, size_is(cbSize)] BYTE *pBuffer,
[in] IUnknown *pReserved // must be NULL
);
into this Delphi code in the _TLB.pas file.
function Write(
cbSize: LongWord;
var pBuffer: Byte;
const pReserved: IUnknown): HResult; stdcall;
However the 2nd parameter is clearly incorrect. To my mind it should be something like
pBuffer : PAnsiChar;
The parameter is a c-type string, passed into the Write to send.
So it seems to me that I should just edit the _TLB.pas file and fix it. There's a couple of other procedures that also have this problem.
But I'm reluctant, as I'd have to redo the edit any time I changed the .idl (hopefully not too often; with the associated hassle of unregistering the .tlb type library before re-importing it) but it doesn't seem right and yet I'm fairly certain that it will not work as is.
What's the best thing I should do? Sticking with C++ is not an option!
"As I understand it a pAnsiChar is effectively a typedef (the Delphi equivalent) for byte *."The Delphi equivalent is PByte. If it had to be PAnsiChar, it should have been coded aschar *. - Rudy Velthuis