Opened on Apr 20, 2026 at 1:56:23 PM
Closed on Apr 20, 2026 at 5:26:49 PM
Last modified on Apr 21, 2026 at 3:38:29 PM
#4089 closed Bug (Fixed)
Fixing __ArrayDisplay_SortArrayStruct dll declaration
| Reported by: | anonymous | Owned by: | Jpm |
|---|---|---|---|
| Milestone: | 3.3.19.0 | Component: | Standard UDFs |
| Version: | 3.3.18.0 | Severity: | None |
| Keywords: | Cc: |
Description
How to reproduct :
Global Const $hDll = 0
#include <Array.au3>
What happened :
".\AutoIt3\Include\ArrayDisplayInternals.au3"(830,40) : error: $hDll previously declared as a 'Const'.
Static $hDll = DllOpen("kernel32.dll")
What should happen :
Nothing, everything should work
Solution :
add "Local" before "Static in ArrayDisplay_SortArrayStruct
Local Static $hDll = DllOpen("kernel32.dll")
Local Static $hDllComp = DllOpen("shlwapi.dll")
If main script doesn't declare $hDll as const, nothing bad happen, each $hDll keep its value, so i think it's more a "false positive" from AU3Check
it only happen if Global Const $hDll = 0 is BEFORE Array.au3 include
Attachments (0)
Change History (5)
comment:2 by , on Apr 20, 2026 at 5:26:49 PM
| Owner: | set to |
|---|---|
| Resolution: | → Fixed |
| Status: | new → closed |
comment:3 by , on Apr 20, 2026 at 7:59:32 PM
Jean-Paul, for the record, I ran the following RegEx pattern in a loop on all include files (155)
The negative lookahead part didn't catch 7 "Static Local" lines found in WinAPIRes.au3 and WinAPISys.au3, which seems correct as they are valid lines.
$aArray = StringRegExp($sFileRead, '(?im)^[\x09\x20]*Static (?!Local).*', 3)
Results
=========
Excel.au3
Static $bState[101] = [0]
=========
WinAPIGdiInternals.au3
Static $pProc = 0
Static $pProc = 0
Static $pProc = 0
=========
WinAPIIcons.au3
Static $pProc = 0
=========
Word.au3
Static $bState = False
=========
ArrayDisplayInternals.au3
Static $hDll = DllOpen("kernel32.dll")
Static $hDllComp = DllOpen("shlwapi.dll")
comment:4 by , on Apr 20, 2026 at 9:40:45 PM
| Component: | Au3Check → Standard UDFs |
|---|
comment:5 by , on Apr 21, 2026 at 3:38:29 PM
For info, the following pattern is a bit more precise, taking care of eventual several spaces or Tabs in the line, between the word Static and the word Local. Gladly we don't find this case in any of our include files (or the lines would have appeared in the results of my preceding post)
$aArray = StringRegExp($sFileRead, '(?im)^[ \t]*Static[ \t](?![ \t]*Local).*', 3)

(Forgot my username)