fix(algo): use _putenv_s on Windows for ARROW_DEFAULT_MEMORY_POOL - #51
Merged
Conversation
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.
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.
Problem
Windows CI fails to compile
algo_extension.cppwith: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
_WIN32and use_putenv_son Windows. Since_putenv_salways overwrites, agetenv()check preserves theoverwrite=0("respect a user-provided value") semantics of the originalsetenvcall. POSIX path is unchanged.Notes
_putenv_slives in<cstdlib>, which is already included.test/test_runner/test_parser.cpp,test/common/extension_proxy_test.cpp).