DLL's and D

Andrej Mitrovic andrej.mitrovich at gmail.com
Thu Mar 15 15:30:15 PDT 2012


On 3/15/12, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:
> It's correct, albeit a bit ugly. To alleviate the ugliness, you can tell
> the compiler where the "root" directory for the library is supposed to
> be. For example, if you invoked dmd with -ILibraries/Math, then you'll
> be able to say:
>
> 	import math.matrix;
>

What import path you need to pass depends on the *module declaration*
and not the relative location of some module from a directory (this
isn't C/C++). If the module declaration is "module Math.math.matrix;"
you'll never be able to do "import math.matrix;", you will always have
to import it with "import Math.math.matrix;" regardless of any -I
switch.

And then when you know the module declaration, figuring out the import
switch is easy. It's always one directory UP of the base package.


More information about the Digitalmars-d-learn mailing list