fix(sqlite-objstore): provide win32 dirent shim so MSVC builds compile - #22
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to unblock Windows (MSVC / clang-cl) builds of the vendored sqlite-objstore dependency by removing the hard dependency on <dirent.h> and introducing a minimal Win32 replacement used by the filesystem backends.
Changes:
- Add a minimal Win32
opendir/readdir/closedirshim (win_dirent.{h,c}) forsqlite-objstore. - Switch the affected objstore backends to include the shim on
_WIN32instead of<dirent.h>. - Update both the objstore subproject CMake and the top-level embedded-source list to compile
win_dirent.conWIN32.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| third_party/sqlite-objstore/src/win_dirent.h | Introduces a minimal dirent/DIR API surface for Windows builds. |
| third_party/sqlite-objstore/src/win_dirent.c | Implements opendir/readdir/closedir using Win32 file enumeration APIs. |
| third_party/sqlite-objstore/src/CMakeLists.txt | Adds win_dirent.c to objstore sources when building on Windows. |
| third_party/sqlite-objstore/src/backend_portable.c | Uses win_dirent.h on _WIN32 instead of <dirent.h>. |
| third_party/sqlite-objstore/src/backend_fs_common.c | Uses win_dirent.h on _WIN32 instead of <dirent.h>. |
| third_party/sqlite-objstore/src/backend_file.c | Uses win_dirent.h on _WIN32 instead of <dirent.h>. |
| CMakeLists.txt | Ensures embedded objstore builds compile win_dirent.c on Windows. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+30
to
+41
| handle = FindFirstFileA (path, &find_data); | ||
| if (handle == INVALID_HANDLE_VALUE) | ||
| { | ||
| free (dir); | ||
| errno = ENOENT; | ||
| return NULL; | ||
| } | ||
|
|
||
| dir->handle = (void *) handle; | ||
| memcpy (dir->entry.d_name, find_data.cFileName, | ||
| sizeof (find_data.cFileName)); | ||
| dir->entry_valid = 1; |
Comment on lines
+67
to
+69
| memcpy (dir->entry.d_name, find_data.cFileName, | ||
| sizeof (find_data.cFileName)); | ||
| dir->entry_valid = 1; |
This was referenced Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The npm release pipeline for
@augmem/cortextv1.3.3 builds all six N-APIaddons from this exact tag. Both Windows matrix jobs (win32-x64 on MSVC,
win32-arm64 on clang-cl) fail with:
The objstore file backends use only
opendir/readdir(d_nameonly)/closedir, which does not exist on Windows. This adds a minimal vendoredwin32 shim (FindFirstFileA/FindNextFileA/FindClose) selected via a
_WIN32include guard in the three affected files, plus a WIN32 guard inboth CMake source lists (subproject and top-level embedded list).
Verified: object-level cross-compilation of all four translation units for
x86_64-windows-gnuandaarch64-windows-gnuvia zig (same_WIN32codepath as MSVC/clang-cl; zig on this host has no MSVC sysroot), zero
-pedanticwarnings; native macOS arm64 objstore suite 4/4 ctest,80/80 unit tests, warnings-as-errors clean.