-
-
Notifications
You must be signed in to change notification settings - Fork 258
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
[Windows] Unresolved symbol in shared static this. #3916
Comments
Thx; finally found some time to reproduce. Reduced ( import std.random : Xorshift, unpredictableSeed;
private __gshared Xorshift engine;
shared static this()
{
engine = Xorshift(unpredictableSeed);
} It works with |
kinke
added a commit
to kinke/ldc
that referenced
this issue
Feb 28, 2022
…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
added a commit
to kinke/ldc
that referenced
this issue
Feb 28, 2022
…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
added a commit
to kinke/ldc
that referenced
this issue
Feb 28, 2022
…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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output from the build:
Turning it to a function makes it compile and resolve successfully, also needs to include the math package as the bare minimum.
The text was updated successfully, but these errors were encountered: