Skip to content

Commit c478f4c

Browse files
Ship the shared Boehm in the Windows release package
A program that loads a tslang shared library needs Boehm as a DLL (item 5ao), but the release zip only carried the static gc.lib. The release workflow now builds the shared collector before configuring tslang, so its own -shared tests run, and packages gc.lib (import library) + gc.dll under gcdll/ - a separate folder because both libraries are named gc.lib. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 8068d5e commit c478f4c

2 files changed

Lines changed: 35 additions & 3 deletions

File tree

‎.github/workflows/create-release.yml‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,28 @@ jobs:
122122
run: cmake --install . --config ${{ env.BUILD_TYPE }}
123123
shell: pwsh
124124

125+
# Boehm as a DLL: an executable and a tslang shared library that each link the static
126+
# gc.lib get two collectors, and one frees what the other still holds (item 5ao). Used by
127+
# the -shared tests, and shipped in the zip's gcdll folder. Mirrors
128+
# scripts/build_gc_release_shared_vs.bat; installed before tslang is configured, since the
129+
# test CMakeLists checks for it at configure time.
130+
- name: Configure GC (shared)
131+
continue-on-error: false
132+
run: New-Item -ItemType Directory -Force -Path ".\__build\gcdll\msbuild\x64\release" | Out-Null; cd ".\__build\gcdll\msbuild\x64\release"; cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/3rdParty/gcdll/x64/release -DBUILD_SHARED_LIBS=ON -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
133+
shell: pwsh
134+
135+
- name: Build GC (shared)
136+
continue-on-error: false
137+
working-directory: ${{github.workspace}}/__build/gcdll/msbuild/x64/release
138+
run: cmake --build . --config ${{ env.BUILD_TYPE }} -j 8
139+
shell: pwsh
140+
141+
- name: Install GC (shared)
142+
continue-on-error: false
143+
working-directory: ${{github.workspace}}/__build/gcdll/msbuild/x64/release
144+
run: cmake --install . --config ${{ env.BUILD_TYPE }}
145+
shell: pwsh
146+
125147
- name: Configure
126148
continue-on-error: false
127149
working-directory: ${{github.workspace}}/__build/tslang/msbuild/x64/release
@@ -182,7 +204,12 @@ jobs:
182204
# are preserved:
183205
# defaultlib/{dll,lib}/{debug,release}/{gc,rc,none},
184206
# defaultlib/*.d.ts, defaultlib/generics/
185-
run: Get-ChildItem -Path .\tslang\msbuild\x64\release\bin\tslang.exe, .\tslang\msbuild\x64\release\bin\TypeScriptRuntime.dll, .\gc\msbuild\x64\release\${{ env.BUILD_TYPE }}\gc.lib, .\tslang\msbuild\x64\release\lib\TypeScriptAsyncRuntime.lib, ..\3rdParty\llvm\x64\release\lib\LLVMSupport.lib, ..\3rdParty\llvm\x64\release\bin\wasm-ld.exe, ..\TypeScriptCompilerDefaultLib\__build | Compress-Archive -DestinationPath ..\tslang.zip
207+
# plus the shared collector in its own folder, because its import library is also named
208+
# gc.lib: gcdll/gc.lib + gcdll/gc.dll, for programs that load a tslang shared library.
209+
run: |
210+
New-Item -ItemType Directory -Force -Path .\gcdll_stage\gcdll | Out-Null
211+
Copy-Item -Path ..\3rdParty\gcdll\x64\release\lib\gc.lib, ..\3rdParty\gcdll\x64\release\bin\gc.dll -Destination .\gcdll_stage\gcdll -ErrorAction Stop
212+
Get-ChildItem -Path .\tslang\msbuild\x64\release\bin\tslang.exe, .\tslang\msbuild\x64\release\bin\TypeScriptRuntime.dll, .\gc\msbuild\x64\release\${{ env.BUILD_TYPE }}\gc.lib, .\tslang\msbuild\x64\release\lib\TypeScriptAsyncRuntime.lib, ..\3rdParty\llvm\x64\release\lib\LLVMSupport.lib, ..\3rdParty\llvm\x64\release\bin\wasm-ld.exe, ..\TypeScriptCompilerDefaultLib\__build, .\gcdll_stage | Compress-Archive -DestinationPath ..\tslang.zip
186213
shell: pwsh
187214

188215
- name: Archive Zip of Windows Asset

‎docs/memory-models.md‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,13 @@ the executable's roots, so it frees objects the executable is still holding. The
124124
a crash: the freed memory is reallocated and the program reads a plausible wrong value, which
125125
only shows up when what was written over it differs from what was there.
126126

127-
Build the shared collector with `scripts/build_gc_release_shared_vs.bat`, link against
128-
`3rdParty/gcdll/x64/release/lib/gc.lib`, and ship `gc.dll` beside the executable.
127+
The Windows release package ships the shared collector in its `gcdll` folder, beside the static
128+
`gc.lib` at its root — both files are named `gc.lib`, so the folder is what tells them apart.
129+
Compile the executable **and** every shared library with `--gc-lib-path=<package>/gcdll`, and
130+
ship `gcdll/gc.dll` beside the executable.
131+
132+
From a source build, the same files come from `scripts/build_gc_release_shared_vs.bat`: link
133+
against `3rdParty/gcdll/x64/release/lib/gc.lib` and ship `3rdParty/gcdll/x64/release/bin/gc.dll`.
129134

130135
Statically linked programs are unaffected and keep the static `gc.lib` — one binary already
131136
means one collector. `-mm=rc` and `-mm=none` are unaffected either way: neither has a collector.

0 commit comments

Comments
 (0)