Modify

#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:1 by TommyDDR, on Apr 20, 2026 at 1:57:08 PM

(Forgot my username)

comment:2 by Jpm, on Apr 20, 2026 at 5:26:49 PM

Owner: set to Jpm
Resolution: Fixed
Status: newclosed

Fixed by revision [13371] in version: 3.3.19.0

Fixed #4089: Static not declared as Local in some UDF.

comment:3 by pixelsearch, 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 Jos, on Apr 20, 2026 at 9:40:45 PM

Component: Au3CheckStandard UDFs

comment:5 by pixelsearch, 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)

Modify Ticket

Action
as closed The owner will remain Jpm.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.