# SDL: wikiheaders: Sort headers before processing.

**URL:** <https://discourse.libsdl.org/t/sdl-wikiheaders-sort-headers-before-processing/69404>\
**Category:** SDL Commits\
**Created:** [September 26, 2026, 4:25am UTC](https://discourse.libsdl.org/t/sdl-wikiheaders-sort-headers-before-processing/69404 "2026-09-26T04:25:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [September 26, 2026, 4:25am UTC](https://discourse.libsdl.org/t/sdl-wikiheaders-sort-headers-before-processing/69404/1 "2026-09-26T04:25:43Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/a9bd41592d21a2c31348039fb1be843931cbf2e8>
>
> Otherwise, you might get SDL\_main\_impl.h after SDL\_main.h, which destroys its
> en…try in the quick reference. (Fix for that coming in a later commit.)

```diff
From a9bd41592d21a2c31348039fb1be843931cbf2e8 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sat, 26 Sep 2026 00:14:11 -0400
Subject: [PATCH] wikiheaders: Sort headers before processing.

Otherwise, you might get SDL_main_impl.h after SDL_main.h, which destroys its
entry in the quick reference. (Fix for that coming in a later commit.)
---
 build-scripts/wikiheaders.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/build-scripts/wikiheaders.pl b/build-scripts/wikiheaders.pl
index 801f7ea83901f..8c14a1fa9aeb5 100755
--- a/build-scripts/wikiheaders.pl
+++ b/build-scripts/wikiheaders.pl
@@ -1128,8 +1128,8 @@ sub generate_envvar_wiki_page {
 }
 
 opendir(DH, $incpath) or die("Can't opendir '$incpath': $!\n");
-while (my $d = readdir(DH)) {
- my $dent = $d;
+foreach (sort(readdir(DH))) {
+ my $dent = $_;
     next if not $dent =~ /$selectheaderregex/; # just selected headers.
     open(FH, '<', "$incpath/$dent") or die("Can't open '$incpath/$dent': $!\n");
 

```
