On 09.08.2017 23:24, Johnson Jones wrote:
I routinely get this error when I forget to add a module that I import
to the project. It throughs me for a loop because the error doesn't
really make sense for what is actually wrong(or does it?):
Error 42: Symbol Undefined _D9DLLImport12__ModuleInfoZ
Adding DLLImport.d to the project solves the problem.
I guess this is due to the fact that the module does not have a library
backing and the __ModuleInfo function isn't generated for it so it
doesn't exist anywhere? (Just guessing)
The symbol reference to the ModuleInfo is usually caused by an import.
It is added to the ModuleInfo of the importing module to ensure properly
ordered execution of (shared) static constructors. Only modules that
have "static this()" or that import modules that have it are affected.
Is there any way Visual D can help with this? Either watch out for the
error(I guess this is a dmd problem) and rename it or add a hint about
adding it to the project or somehow detect the modules and add them
silently to the command line or even auto add them to the project?
Visual D already helps a bit by demangling the symbol and adding it to
the error message (the part in parenthesis is not emitted by the linker).
I don't think silently trying to add modules to the command line is a
good idea (follow-up errors can cause even more confusion). Making
suggestions regarding missing symbols could be helpful, though. dmd
already does that on Posix systems if no "main" is defined.