On Thursday, 12 April 2018 at 07:48:28 UTC, Jamie wrote:
 Really, it's more like:

    module A.a;
    import std.stdio;
    import B.b;
    void main()
    module B.b;
    size_t f(size_t input)
        return input * 2;

And in A/ I'm compiling
    dmd -ofoutput a.d ../B/b.d

and instead I was thinking I could compile with
    dmd -ofoutput a.d -I../B b.d

and would get the same result. The former works, the latter does not. Is there something like this that I can use or do I have to pass all the files with the direct path to them? Thanks

I think that the typical model (at least in other languages) is to only compile one D source file at a time. Compile the b.d file with the -c option to create an object file. Then put the object file in a library file (either static (easier) or dynamic). Then you can use the -L compiler option to specify the directory of the library and the -l compiler option to specify the library (library name is shortened - libb.a referenced as -lb).

Reply via email to