Skip to content

gateway: declare TStringArray locally in RelayQueue for dcc64 (PR #318 follow-up) - #320

Merged
FMXExpress merged 1 commit into
mainfrom
claude/relayqueue-dcc64-tstringarray
Jun 21, 2026
Merged

FMXExpress merged 1 commit into
mainfrom
claude/relayqueue-dcc64-tstringarray

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

Summary

Delphi build broke on PR #318's PasClaw.Gateway.RelayQueue.pas with 11 dcc64 errors all rooted in TStringArray not being a known type. Fix matches the established pattern used elsewhere in the codebase.

Root cause

FPC's SysUtils declares TStringArray = array of string. Delphi's RTL does not. The 11 errors broke down as:

Errors Cause
Lines 172 / 178 / 183 / 220 / 345 / 536 (E2003 / E2005) Field, parameter, and property signatures reference unknown TStringArray
Lines 351 (×2) / 397 / 563 (E2008 "Incompatible types") Cascade — assignments / SetLength against unknown type fail downstream
Line 353 (E2250 "no overloaded Trim") Cascade — Trim(Caps[i]) where Caps is unresolved type

Fix

Local {$IFNDEF FPC} TStringArray = array of string; {$ENDIF} block inside the type section, right at the top before TRelayRequestId. Guarded so FPC builds are unaffected.

"Do we have one we use for all?"

The user's question — and the honest answer is no, we don't have a central shared compat unit. The convention so far is local guarded declarations in each consuming unit. Three other places do it:

  • src/pkg/tools/PasClaw.Tools.Registry.pas (the canonical place with the long-form explanation comment)
  • src/pkg/tools/PasClaw.Tools.Shell.Filters.pas
  • src/cmd/PasClaw.Cmd.Profile.pas

PR #318 missed this established pattern.

Should we centralize?

A PasClaw.RTL.Compat unit re-exporting TStringArray (and any other FPC/Delphi RTL gaps we hit) would let units just uses PasClaw.RTL.Compat instead of repeating the IFNDEF block. Worth considering once we hit this for the 5th time. With 4 instances the duplicate-IFNDEF pattern is still defensible — and the local guard documents the cross-compiler issue right where it's needed. Flagging as a follow-up candidate, not landing here.

Test plan

  • make clean && make passes (FPC build — the Delphi-only declaration is guarded by IFNDEF FPC so FPC is unaffected)
  • make test-relay-queue passes all 14 cases
  • dcc64 verification — needs a Delphi build host; the fix is the same pattern that already compiles cleanly in the three sibling locations

Files

src/pkg/gateway/PasClaw.Gateway.RelayQueue.pas — 9 lines added (the IFNDEF block + comment).


Generated by Claude Code

…follow-up)

Delphi build broke on PR #318's PasClaw.Gateway.RelayQueue.pas:

  [dcc64 Error] (172): E2003 Undeclared identifier: 'TStringArray'
  [dcc64 Error] (178): E2005 'TStringArray' is not a type identifier
  [dcc64 Error] (183): E2005 'TStringArray' is not a type identifier
  [dcc64 Error] (220): E2005 'TStringArray' is not a type identifier
  [dcc64 Error] (345): E2005 'TStringArray' is not a type identifier
  [dcc64 Error] (351): E2008 Incompatible types
  [dcc64 Error] (351): E2008 Incompatible types
  [dcc64 Error] (353): E2250 There is no overloaded version of 'Trim'
  [dcc64 Error] (397): E2008 Incompatible types
  [dcc64 Error] (536): E2005 'TStringArray' is not a type identifier
  [dcc64 Error] (563): E2008 Incompatible types

Root cause: FPC's `SysUtils` declares `TStringArray = array of string`
but Delphi's RTL doesn't. The errors at 351/353/397/563 (E2008
"Incompatible types", E2250 "no overloaded Trim") are cascade failures
-- once dcc64 can't resolve the field/parameter type at 172/178/183,
every subsequent `SetLength(Caps, ...)`, `Caps[i] := LowerCase(Trim(...))`,
and assignment chains through unknown-type which then mismatch in
arithmetic/Trim call sites.

Fix: declare `TStringArray` locally inside the type block, guarded by
`{$IFNDEF FPC}`. Matches the established codebase pattern:

  - src/pkg/tools/PasClaw.Tools.Registry.pas (the canonical place,
    has the long-form comment explaining the FPC/Delphi split)
  - src/pkg/tools/PasClaw.Tools.Shell.Filters.pas
  - src/cmd/PasClaw.Cmd.Profile.pas

PasClaw doesn't have a single shared compatibility unit for these
RTL gaps -- the convention is the local guarded declaration in each
consuming unit. PR #318 missed the pattern.

Tests
=====

  make clean && make passes (FPC build; the Delphi-only declaration is
  guarded by IFNDEF FPC so FPC is unaffected).
  make test-relay-queue passes all 14 cases.

Should i open a follow-up
=========================

A "PasClaw.RTL.Compat" unit that re-exports TStringArray (and any
other FPC/Delphi gaps) under a single import would let units just
`uses PasClaw.RTL.Compat` instead of duplicating the IFNDEF block --
worth considering once we hit this for the 5th time. With 4 instances
the duplicate-IFNDEF pattern is still defensible. Flagging as a
follow-up candidate, not landing here.
@FMXExpress
FMXExpress merged commit 4570897 into main Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants