package.d
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Wed Dec 18 07:48:29 PST 2013
On 18/12/13 10:41, Leandro Motta Barros wrote:
> With these simple examples I sent, rdmd seem to resolve dependecies correctly.
> For example, with this last example I sent (which prints the class name):
>
> $ rdmd main.d
> mylib.util.Foo
If I create an example analogous to yours, it seems OK. However, I was dealing
with a case where the package is at the 2nd level of the subdirectory hierarchy:
std/random2/package.d
std/random2/generator.d
std/random2/distribution.d
and so on. That might have something to do with it.
> $ dmd main.d
> main.o: In function `_Dmain':
> main.d:(.text._Dmain+0xb): undefined reference to `_D5mylib4util3Foo7__ClassZ'
> collect2: error: ld returned 1 exit status
> --- errorlevel 1
Well, quite. dmd doesn't resolve dependencies, it expects you to pass it all
the necessary source or object files ...
> $ dmd main.d mylib/util.d
> $ ./main
> mylib.util.Foo
... like this.
> In this case, at least, rdmd correctly resolved, compiled and linked
> mylib/util.d, which was imported through a package.
I think that there must be a problem with packages that are in the 2nd rather
than 1st level of the subdirectory hierarchy.
More information about the Digitalmars-d-learn
mailing list