Repository navigation
Conversation
….def on MSVC The generated module-definition file already exports, and therefore keeps, every symbol. The redundant /INCLUDE flags exceed the 32,767 character Windows command-line limit for thousands of symbols. Also stop naming the DLL MyDLL in the generated module-definition file.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3713 +/- ##
=======================================
Coverage 87.89% 87.89%
=======================================
Files 310 310
Lines 19771 19772 +1
=======================================
+ Hits 17377 17378 +1
Misses 2394 2394
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
mosuem
marked this pull request as ready for review
September 30, 2026 12:30
This was referenced Sep 30, 2026
Member
Author
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.
Description
On Windows,
LinkerOptions.treeshakepasses an/INCLUDE:<symbol>flag per kept symbol and a generated module-definition (.def) file that exports the same symbols. TheEXPORTSin the.deffile already makelink.exeresolve (pull in from the archive) and keep every symbol, so the/INCLUDE:flags are redundant.They are also harmful for large APIs: with thousands of symbols (e.g. BoringSSL or ICU4X bindings), the flags exceed the 32,767 character command-line limit of Windows and the link fails. Packages such as
package:boringcurrently work around this by parsing the COFF archive and writing their own.deffile withLinkerOptions.manual. With this change,LinkerOptions.treeshakeworks for them directly.Changes:
/INCLUDE:flags forcl.exewhen the.deffile is generated (LinkerOptions.treeshakewith non-nullsymbolsToKeep).LinkerOptions.manualis unchanged.LIBRARY MyDLLplaceholder (and the trailing whitespace) from the generated.deffile, so the DLL name comes from/OUTinstead of a mismatchingMyDLL(LNK4070).treeshake_many_symbols_test.dart, which keeps 1,500 of 2,000 long-named plain C functions (without__declspec(dllexport)), i.e. ~110K characters of/INCLUDE:flags before this change.The existing
windows_module_definition_test.dart(and its cross variant for ia32/arm64) already covers that the generated.defalone pulls in a non-exported function from the archive; this PR relies on Windows CI for that, as I only ran the tests on Linux locally.Not included (possible follow-ups): skipping requested symbols that the archive doesn't define (both
/INCLUDE:and.defexports fail with LNK2001 for those;package:boringfilters them via the COFF symbol table).Related Issues
None filed.
PR Checklist
dart tool/ci.dart --alllocally and resolved all issues identified. (Randart formatanddart analyze --fatal-infosonpkgs/native_toolchain_c.)CHANGELOG.mdfor the relevant packages.0.19.6-wip.)