Skip to content

fix(algo): use _putenv_s on Windows for ARROW_DEFAULT_MEMORY_POOL - #51

Merged
adsharma merged 1 commit into
mainfrom
fix/win-setenv-arrow-pool
Aug 9, 2026
Merged

fix(algo): use _putenv_s on Windows for ARROW_DEFAULT_MEMORY_POOL#51
adsharma merged 1 commit into
mainfrom
fix/win-setenv-arrow-pool

Conversation

@adsharma

@adsharma adsharma commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Problem

Windows CI fails to compile algo_extension.cpp with:

D:\a\ladybug\ladybug\extension\algo\src\main\algo_extension.cpp(21): error C3861: 'setenv': identifier not found

Introduced by 52298ee ("fixup: set ARROW_DEFAULT_MEMORY_POOL=system once at extension load"), which was tested on macOS/Linux only — setenv() is POSIX-only and not available on MSVC.

Fix

Guard with _WIN32 and use _putenv_s on Windows. Since _putenv_s always overwrites, a getenv() check preserves the overwrite=0 ("respect a user-provided value") semantics of the original setenv call. POSIX path is unchanged.

Notes

  • _putenv_s lives in <cstdlib>, which is already included.
  • Same pattern already used in the repo (test/test_runner/test_parser.cpp, test/common/extension_proxy_test.cpp).

setenv() is POSIX-only and fails to compile on MSVC (C3861). Use
_putenv_s guarded by a getenv() check to keep the overwrite=0
"respect a user-provided value" semantics of the original call.

Closes the Windows CI breakage introduced by 52298ee.
@adsharma
adsharma merged commit 3efa16a into main Aug 9, 2026
2 checks passed
@adsharma
adsharma deleted the fix/win-setenv-arrow-pool branch August 9, 2026 23:34
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