Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3916 - undefined symbols with -dllimport=all on Windows #3923

Merged
merged 1 commit into from
Feb 28, 2022

Commits on Feb 28, 2022

  1. Fix ldc-developers#3916 - undefined symbols with -dllimport=all on Wi…

    …ndows
    
    Instantiated data symbols were previously never dllimported with
    `-dllimport=all`. So if the parent template instance wasn't
    codegen'd into the binary directly, it remained undefined.
    
    For `-dllimport=defaultLibsOnly`, the 'solution' to this problem
    was to define-on-declare data symbols instantiated from druntime/
    Phobos templates, making sure each binary defines all such symbols
    it references.
    
    In both cases, switch to an approach where we dllimport all
    instantiated data symbols (or druntime/Phobos symbols only), and
    dllexport them whenever defining them (so that other object files
    or binaries can import them). This may lead to more 'importing
    locally defined symbol' linker warnings, but may also lead to less
    duplicates and possibly 'proper' sharing of instantiated globals
    across the whole process.
    
    This is superfluous and skipped with `-linkonce-templates`, as
    that mode defines all referenced instantiated symbols in each
    binary anyway, and so has already been a workaround.
    kinke committed Feb 28, 2022
    Configuration menu
    Copy the full SHA
    3fa8a2e View commit details
    Browse the repository at this point in the history