How do you create a .di file for multiple .d files?
Jonathan M Davis
jmdavisProg at gmx.com
Tue Oct 12 16:19:24 PDT 2010
On Tuesday, October 12, 2010 16:07:29 Jesse Phillips wrote:
> Jonathan M Davis Wrote:
> > Okay, I'm trying to figure out how to take multiple .d files and use a
> > single .di file for them. It looks like if you have x.di file with a
> > corresponding x.d file (so, only one .d file), you put package x; at the
> > top of both files, and dmd is able to deal with it, knowing that the .d
> > file holds the implementation for the .di file. But what about multiple
> > .d files? I very much doubt that you can put package x; at the top of
> > several .d files and have dmd be happy with you. You can't do that
> > normally, but maybe you can do that if you have a .di file?
> I don't use .di files but it sounds like you what to use them for a
> different purpose then what they are for. The .di is actually telling the
> linker where it needs to find the functions. If you provide functions from
> multiple modules, how will the linker know which module to look in to get
> the code?
> Also if you have the .d file there is no need for the .di file (they aren't
> header files). So what is the reason for only wanting one .di file?
It's what Walter suggested doing to have a single std.datetime to import but
have multiple modules for the actual implementation (he mentioned it in the
datetime review thread on the Phobos list). He said to look at druntime for
examples, but all of the .di files that I see there appear to have a single .d
file corresponding to them. If there is one with multiple .d files, I missed it.
- Jonathan M Davis
More information about the Digitalmars-d-learn