[v2] DllCall * or P (suffix) type description

Share your ideas as to how the documentation can be improved.
iPhilip
Posts: 818
Joined: 02 Oct 2013, 12:21

[v2] DllCall * or P (suffix) type description

Post by iPhilip » 05 Apr 2021, 11:39

I would like to recommend that the following sentence be added at the end of the first paragraph in the * or P (suffix) type description:
lexikos wrote: The output value (if any) of numeric parameters with the * or P suffix is ignored if the script passes a plain variable containing a number. To receive the output value, pass a VarRef such as &myVar or an object with a Ptr property.
Thus, the paragraph would read as follows:
https://lexikos.github.io/v2/docs/commands/DllCall.htm#types wrote: Append an asterisk (with optional preceding space) to any of the above types to cause the address of the argument to be passed rather than the value itself (the called function must be designed to accept it). Since the value of such an argument might be modified by the function, whenever a VarRef is passed as the argument, the variable's contents will be updated after the function returns. For example, the following call would pass the contents of MyVar to MyFunction by address, but would also update MyVar to reflect any changes made to it by MyFunction: DllCall("MyDll\MyFunction", "Int*", &MyVar). The output value (if any) of numeric parameters with the * or P suffix is ignored if the script passes a plain variable containing a number. To receive the output value, pass a VarRef such as &myVar or an object with a Ptr property.
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)

lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: [v2] DllCall * or P (suffix) type description

Post by lexikos » 05 Apr 2021, 21:01

That's redundant, but I see that "whenever a VarRef is passed as the argument" maybe isn't explicit enough for some.

However, I think we can drop "of numeric parameters with the * or P suffix". Repeating the redundant "parameters with the * or P suffix" seems unnecessary, and IIRC this applies just the same to "Str*" (with the "output value" in that case typically being a new string pointer, not pointing to the original variable's string buffer).

Post Reply

Return to “Suggestions on Documentation Improvements”