module mod;
// import inc; [1]
// import inc: p=print; [1]
// static import inc; [1]

void main()
{
    // import inc: print; // [2]
    print();

    // static import inc; // [3]
    // inc.print();
}

------------------------------
module inc;

/*public*/ void print() // [4]
{
    import std.stdio: writeln;
    writeln("You made it!");
}

------------------------------
compiler: DMD v2.071.0
os: OS X El Capitan (10.11.3)

------------------------------
command: dmd -run mod inc

output:

Undefined symbols for architecture x86_64:
  "_D3inc5printFZv", referenced from:
      __Dmain in mod.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- errorlevel 1

None of the variations of imports work when compiled with the -run switch but all work perfectly well without it.

Reply via email to