[Dlang-internal] Attempt to export ModuleInfo on Windows
Rikki Cattermole
alphaglosined at gmail.com
Fri Nov 18 19:13:08 UTC 2022
After doing some more work on my projects I ended up getting a
very interesting error message with ldc:
```
sidero_image-test-unittest.obj : error LNK2019: unresolved
external symbol __imp__D6sidero4base4hash5utils12__ModuleInfoZ
referenced in function ldc.dllimport_relocation
sidero_image-test-unittest.obj : error LNK2019: unresolved
external symbol __imp__D6sidero4base4hash3fnv12__ModuleInfoZ
referenced in function ldc.dllimport_relocatio
```
What is interesting about this little error is that it is
referencing the DllImport symbols from a ldc function. Generated
from [0]. It's doing additional patching on top of the OS linker
which is effectively dereference and set at start of runtime.
This kinda rules out that it is simply a limitation of dmd and
instead is a conceptual problem at the system linker & codegen
level.
So what does this mean for dmd? Well, either we copy the solution
from ldc or we do the patching as needed. I think patching as
needed may be the best bet, but that means changing druntime in
two places with an additional memory allocation when calling
importedModules.
[0]
https://github.com/ldc-developers/ldc/blob/03e35c5ce57e665e89f5ee2efeaffe958ba815d4/gen/passes/DLLImportRelocation.cpp#L183
More information about the Dlang-internal
mailing list