importtl/typelib.pas - COM DLL incorrect declaration for getter functions
For full details/discussion https://forum.lazarus.freepascal.org/index.php/topic,74031.0.html
How to reproduce,
Faced this issue while trying importtl with Microsoft Debug Interface Access COM DLL
1. run `importtl.exe msdia140.dll`
2. the resulting pascal file has incorrect declaration for all property getters,
e.g
Excerpt from Typelib viewer (just to double-check that TLB is fine)
`\[id(0x0000000a), propget, helpstring(".")\] HRESULT relativeVirtualAddress(\[out, retval\] unsigned long\* pRetVal);`
the corresponding declaration is
`function Get_relativeVirtualAddress : LongWord; stdcall;`
In short the getter takes a `pointer to LongWord as argument` to store the output/result and returns `HRESULT`, but it gets declared as a `function returning LongWord with no argument`.
which of course causes access violation errors.
**Possible fix tried**,
Manually replacing (calling convention) **`"stdcall"`** with **`"safecall"`** for all getter declarations fixes the issue.
issue