ITypeInfo.GetIdOfNames definition problem lazarus / 67-Windows ---------------------------------------------------------------------- 440bx · 2025-06-29 06:11 Hello, In activex.pp, in the ITypeInfo interface, the method GetIdOfNames is defined as: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i       Function  GetIDsOfNames(CONST rgszNames: pOleStr; cNames: UINT; OUT pMemId: MEMBERID):HResult;StdCall; In that definition the first parameter is a pointer to an OleStr (note that in this case "const" does not cause a pointer to that pointer to be passed as the first parameter, IOW, in this case, "const" has no functional effect.) The C definition of that method is: Code: C  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i HRESULT GetIDsOfNames(  [in]  LPOLESTR *rgszNames,  [in]  UINT     cNames,  [out] MEMBERID *pMemId); The first parameter is a pointer to an array of pointers to arrays of wide characters. In Pascal that would be ^^OLESTR or ^POLESTR or PPOLESTR. The current Pascal definition declares a pointer to a widechar array instead of a pointer to an array of pointers to widechar arrays. Note that using "var" or "constref" to a pwidechar in this case does not declare that it is an array of pointers which complicates matters if/when the method needs to be used. HTH. ---------------------------------------------------------------------- gues1 · 2025-06-29 10:02 Quote from: 440bx on June 29, 2025, 08:11:45 amIn activex.pp, in the ITypeInfo interface, the method GetIdOfNames is defined as: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i       Function  GetIDsOfNames(CONST rgszNames: pOleStr; cNames: UINT; OUT pMemId: MEMBERID):HResult;StdCall;  May be this will be the correct definitiion ? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i       Function  GetIDsOfNames(rgszNames: pOleStrLIST; cNames: UINT; OUT pMemId: MEMBERID):HResult;StdCall;      //pOleStrList is definied in the head of unit:     POleStrList = ^TOleStrList;     TOleStrList = array[0..65535] of POleStr; ---------------------------------------------------------------------- 440bx · 2025-06-29 10:32 That would work but, it doesn't follow the pattern in existing correct definitions of arguments that are arrays. The argument should be a pointer to the first array element.  Pointer arithmetic automatically makes that pointer be a pointer to any size array.  This makes the separate declarations of ...LIST unnecessary. Basically, in C, C++ and FPC, a pointer to a is also a pointer to an array of .  This often makes the declaration of array types unnecessary since the pointer implicitly defines an array of . for instance, p : ^integer;  makes p not only a pointer to an integer but also a pointer to an array of integers. ---------------------------------------------------------------------- gues1 · 2025-06-29 13:10 Quote from: 440bx on June 29, 2025, 12:32:28 pmThe argument should be a pointer to the first array element.  Pointer arithmetic automatically makes that pointer be a pointer to any size array.  This makes the separate declarations of ...LIST unnecessary. Basically, in C, C++ and FPC, a pointer to a is also a pointer to an array of .  This often makes the declaration of array types unnecessary since the pointer implicitly defines an array of . for instance, p : ^integer;  makes p not only a pointer to an integer but also a pointer to an array of integers. This is something I don't like. Not at all. The fact that you can behave like in C is an absolute plus for performance, but for stability and possible bugs... I would say we are definitely not there. I know of course that it can be done but I think that something like this should be absolutely avoided (at most I can understand it limited to RTL or RTTI).