ModuleInfo Error

Johnson Jones via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 9 14:29:07 PDT 2017


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 
(DLLImport.__ModuleInfo)

Adding DLLImport.d to the project solves the problem. I'm using 
Visual D so I guess adding the file to the project adds it to the 
includes on the command line.

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)

Surely we could get a better error message for this or dmd could 
somehow try and automatically remedy the situation?

What is __ModuleInfo? An automatically generated function for a 
module by dmd when a module is compiled? If so, why not keep 
track of all the modules that have bee used and if this error 
occurs, compile the module or do whatever needs to be done so the 
error is not necessary?

New users to D will be thrown by this error. It is meaningless as 
far as being helpful and there is virtually no online help for 
it... and one doesn't get this for standard stuff like phobos 
modules, again, I guess because they have a library that has 
these functions in it. I'm pretty sure dmd could auto detect this 
issue and try to resolve it internally. I've gotten it several 
times in different projects in the past.




More information about the Digitalmars-d mailing list