Module Info error

Mike Wey via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 19 04:13:55 PDT 2017


On 19-08-17 04:07, Johnson Jones wrote:
> Still getting this!
> 
> What I don't understand is why I can import certain libraries and they 
> compile fine while others don't!
> 
> So, moduleInfo is a "function" per module that is created at 
> compilation, right?
> 
> If one doesn't compile the module then the error results, just like 
> standard extern functions. When I don't include the file in the project, 
> it doesn't get compiled, even though it gets "imported"? Why? Why can't 
> D just know, hey, module X imports module Y, module Y needs to be 
> compiled to add moduleInfo?
> 
> 
> 
> For example, I am trying to get ffmpeg to work. I downloaded from
> 
> https://github.com/complistic-gaff/ffmpeg-d
> 
> extracted, put that path in my includes(sc.ini). created a module to 
> import the standard modules, tried to compile my project and I get a 
> bunch of ModuleInfo errors relating to the imports I added.
> 
> I use GtkD exactly the same, yet no errors.
> 
> Now, the only difference is that I import the gtkD.lib. I'm assuming 
> that all the moduleInfo's of the 1000+ gtk files are in that lib and so 
> That is the reason I don't have the compile them all, is that correct?
> 
> If so, how can I generate such a lib of moduleInfo's recursively for a 
> directory so I can pick up all the files and just import it once?
> 
> ffmpeg doesn't require compiling but I don't wanna have to include ever 
> file in to my project just to be able to get it to work because of the 
> moduleInfo's are missing.
> 
> Looking at the build.d for gtkD, it looks like it builds a list of all 
> the files to compile and does it recursively.
> 
> I imagine it can be modified for ffmpeg too to create a utility to solve 
> this problem. Dmd should have a mode to do this automatically, it's 
> quite an annoying problem ;/

You need to either compile ffmpeg-d in to a library and include it when 
you are building your application, or pass all the ffmpeg-d source files 
to the compiler.

It looks like ffmpeg-d only has a dub.json file for building so you will 
need to use dub to build it eg: `dub build` from the root of the project.

-- 
Mike Wey


More information about the Digitalmars-d-learn mailing list