Skip to content

Fix build failure on mswin (MSVC) - #34

Open
hsbt wants to merge 2 commits into
cabo:masterfrom
hsbt:claude/elastic-leavitt-ef93f3
Open

Fix build failure on mswin (MSVC)#34
hsbt wants to merge 2 commits into
cabo:masterfrom
hsbt:claude/elastic-leavitt-ef93f3

Conversation

@hsbt

@hsbt hsbt commented Jul 30, 2026

Copy link
Copy Markdown

MSVC does not support C99 variable-length arrays, so char buf[len] in msgpack_packer_write_bignum_value fails to compile on x64-mswin64 with C2057/C2466/C2133. This replaces the VLA with ALLOCV_N, which allocates a GC-managed temporary buffer and stays safe across rb_raise.

With the build fixed, the "Tagged" spec still failed on Windows because unsigned long is 32-bit there and rb_num2ulong raises RangeError for tags above 0xffffffff. cbor_encoder_write_head takes uint64_t, so tag values are now converted with rb_num2ull. Behavior on LP64 platforms is unchanged.

Verified on x64-mswin64_140 (Ruby 4.0.5, MSVC 14.51) with gem build and gem install, and the RSpec suite passes with 170 examples, 0 failures.

hsbt and others added 2 commits July 20, 2026 09:34
MSVC does not support C99 variable-length arrays, so
`char buf[len]` in msgpack_packer_write_bignum_value fails with
C2057/C2466/C2133. Use ALLOCV_N instead, which falls back to a
GC-managed heap buffer and stays safe across rb_raise.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
unsigned long is 32-bit on Windows (LLP64), so rb_num2ulong raises
RangeError for tags above 0xffffffff and the "Tagged" spec fails.
cbor_encoder_write_head takes uint64_t; convert with rb_num2ull.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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