About modules
Regan Heath
regan at netwin.co.nz
Mon Jul 24 15:33:28 PDT 2006
On Mon, 24 Jul 2006 17:18:27 -0300, Damian <damian.pop at gmail.com> wrote:
> I'm with gdc on linux, And think I dont understand how
> files/packages/modules works.
> I am organizing files in folders like this:
>
> /main/something/moda.d
> /main/gui/modb.d
>
> in modb.d: Can I import moda?
> I get "module modb cannot read file..."
>
> Thanks and sorry for my strange english!
If you tell DMD that your import path is the 'root' the one which contains
'main' then in /main/something/moda.d you could write "import
main.gui.modb;". Likewise, in /main/gui/modb.d you would write "import
main.something.moda;".
The import package/module/file is relative to the import path root(s). The
file sc.ini in dmd/bin/ tells it where the import path root(s) are, eg:
DFLAGS="-I%@P%\..\src\phobos;%@P%\..\..\src"
The -I is for import paths, note that I have added %@P%\..\..\src (I'm on
windows), this is my import path root for most of my D source code. %@P%
resolves to the dmd/bin directory.
Regan
More information about the Digitalmars-d-learn
mailing list