// main
void main() {
   import A;
// import B;
   import std.stdio;
   writeln("Entered main");
   fnA1();
   writeln("Leaving main");
}
module A;
void fnA1() {
   import B;
   import std.stdio;
   writeln("Entered fnA1");
   fnB1();
   writeln("Leaving fnA1");
}
module B;
void fnB1() {
   import std.stdio;
   writeln("Entered fnB1");
   writeln("Leaving fnB1");
}
- 
Code above compiles but fails on linker step with 'Error 42 Symbol Undefined'. 
 To me, unexpected behaviour as imports arranged to pick up symbols (with minimum scope).
- 
Uncommenting the 'import B' in main everything works correctly. 
 To me, particularly unexpected behaviour as no symbol from B directly used in main (also undesirable to set scope unnecessarily wide).
Best regards
 Permalink
Permalink Reply
Reply