Skip to content

depends: Bump dlfcn-win32 to v1.4.2#93

Merged
garbear merged 1 commit intoPiersfrom
update-dlfcn-win32
Mar 11, 2026
Merged

depends: Bump dlfcn-win32 to v1.4.2#93
garbear merged 1 commit intoPiersfrom
update-dlfcn-win32

Conversation

@garbear
Copy link
Member

@garbear garbear commented Mar 4, 2026

Description

As title says, I bumped dlfcn-win32 to v1.4.2.

Notable changes:

  • CMake 4.0 support was added in v1.4.2 (dropped our CMake policy patches)
  • Windows ARM64 support was added in v1.4.0.

dlfcn-win32 fork

I rebased the windows UWP patch, but it crashes patch.exe on Azure, so I forked the dlfcn-win32 repo and tagged v1.4.2 with Alwin's commit.

Error on azure was:

Performing patch step for 'dlfcn-win32'
patching file src/dlfcn.c
Assertation failed!

Program: C:\Strawberry\c\bin\patch.exe
File: .\src\patch\2.5.9\patch-2.5.9-src\patch.c, Line 354

Expression: hunk
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'D:\a\1\s\build\CMakeFiles\ff81d8f751455c61eb06ec168b49c1e8\dlfcn-win32-mkdir.rule;D:\a\1\s\build\CMakeFiles\ff81d8f751455c61eb06ec168b49c1e8\dlfcn-win32-download.rule;D:\a\1\s\build\CMakeFiles\ff81d8f751455c61eb06ec168b49c1e8\dlfcn-win32-update.rule;D:\a\1\s\build\CMakeFiles\ff81d8f751455c61eb06ec168b49c1e8\dlfcn-win32-patch.rule;D:\a\1\s\build\CMakeFiles\ff81d8f751455c61eb06ec168b49c1e8\dlfcn-win32-configure.rule;D:\a\1\s\build\CMakeFiles\ff81d8f751455c61eb06ec168b49c1e8\dlfcn-win32-build.rule;D:\a\1\s\build\CMakeFiles\ff81d8f751455c61eb06ec168b49c1e8\dlfcn-win32-install.rule;D:\a\1\s\build\CMakeFiles\b92e65488deb09c80c81783db8877d8a\dlfcn-win32-complete.rule;D:\a\1\s\build\CMakeFiles\2519d97468e2ef66918e641805db7c70\dlfcn-win32.rule;D:\a\1\kodi\cmake\addons\CMakeLists.txt' exited with code 3. [D:\a\1\s\build\dlfcn-win32.vcxproj]

Then in the depends file I set the repo to my fork + the commit:

dlfcn-win32 https://github.com/garbear/dlfcn-win32/archive/refs/tags/v1.4.2-uwp2.tar.gz

How has this been tested?

Compile-tested on Windows 10 x64. Runtime testing in progress.

Other add-ons

The following add-ons use dlfcn-win32 and should be updated:

@kodiai
Copy link

kodiai bot commented Mar 4, 2026

Kodiai Review Summary

What Changed

Bumps dlfcn-win32 from v1.2.0 to v1.4.2, adding widechar support for Windows and switching to forked repo for UWP compatibility.

Reviewed: core logic, docs

Strengths

  • ✅ Successfully removes need for CMake policy patches by upgrading to v1.4.2 which supports CMake 4.0
  • ✅ Adds Windows ARM64 support via upstream v1.4.0 changes

Observations

Impact

[MAJOR] depends/windows/dlfcn-win32/0001-dlopen_with_widechar.patch (22): Memory leak when MultiByteToWideChar succeeds but LoadLibraryExW fails
Missing free(lpFileNameW) on the error path when hModule is still NULL after LoadLibraryExW. If the library load fails, lpFileNameW is never freed.

[MAJOR] depends/windows/dlfcn-win32/0001-dlopen_with_widechar.patch (22): Missing null check after malloc
malloc(wide_len * sizeof(wchar_t)) can return NULL on allocation failure, but the code immediately uses lpFileNameW without checking, causing null pointer dereference.

[MEDIUM] depends/windowsstore/dlfcn-win32/dlfcn-win32.txt (1): Using forked repository instead of upstream
The windowsstore version uses github.com/garbear/dlfcn-win32 fork while windows version uses upstream. This creates maintenance risk if the fork diverges or becomes unavailable. Consider upstreaming the UWP patch or documenting the long-term fork maintenance plan.

Verdict

🔴 Address before merging -- 2 blocking issue(s) found

Review Details
  • Files reviewed: 7
  • Lines changed: +44 -155
  • Profile: balanced (auto, lines changed: 199)
  • Author: core (adapted tone)
  • Findings: 0 critical, 2 major, 1 medium, 0 minor (includes 3 from summary observations)
  • Review completed: 2026-03-04T07:23:14.297Z
  • Keyword parsing: No keywords detected

@garbear garbear force-pushed the update-dlfcn-win32 branch from 07706ea to ffbb98c Compare March 11, 2026 00:13
@garbear garbear merged commit bc26c69 into Piers Mar 11, 2026
10 checks passed
@garbear garbear deleted the update-dlfcn-win32 branch March 11, 2026 13:41
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.

1 participant