Simple import question
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Oct 16 06:03:40 PDT 2014
On 10/16/14 6:59 AM, Rei Roldan wrote:
> On Wednesday, 15 October 2014 at 16:11:22 UTC, Steven Schveighoffer wrote:
>> *snip*
>
> You might of missed Adam's response up there:
>
> " But the best way is to explicitly pass all the file names to the
> compiler:
>
> dmd yourfile.d file2.d folder/file3.d and so on...
>
> Doing that will serve you best in the long run, it will work with
> any module name and will link better too. "
No, I didn't miss it. As I said, you can do this with mismatched module
and file names, but you will encounter issues if your files need to be
imported elsewhere.
Note, you can send all the files to the compiler, AND name your
files/directories after your modules/packages. Matching the names
actually gives you the most options.
> I also prefer explicitly telling the compiler what I want to be compiled
> instead of the "start here and pull everything you can find" approach.
What I am specifically identifying as a problem is if you purposely do
not name your files and directories after your module structure. Then
you are REQUIRED to pass all the files to the compiler, and this doesn't
work out well if you just want to import them (and not compile them),
e.g. for a pre-compiled library.
-Steve
More information about the Digitalmars-d-learn
mailing list