www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D import stmt doesn`t seem to ' import'

reply Andy Balba <pwplus7 gmail.com> writes:
if file hh.d  contains :
   int hh_t ( int x)
   { writeln ("hhh x= ", x );
   }

and file test.d (in same dir as file hh.d ) contains :

import std.stdio ;
import hh ;
void main()
{  hh_t(3);
}

Why does compiling test.d generate an "undefined ref"   ?
Jul 27 2020
parent FeepingCreature <feepingcreature gmail.com> writes:
On Tuesday, 28 July 2020 at 05:45:03 UTC, Andy Balba wrote:
 if file hh.d  contains :
   int hh_t ( int x)
   { writeln ("hhh x= ", x );
   }

 and file test.d (in same dir as file hh.d ) contains :

 import std.stdio ;
 import hh ;
 void main()
 {  hh_t(3);
 }

 Why does compiling test.d generate an "undefined ref"   ?
dmd test.d hh.d or dmd -i test.d. import is purely at the language level, it doesn't affect the linker.
Jul 27 2020