Hello Simen,
////////////////////
module a;
extern void foo( );
void bar( ) {
foo( );
}
////////////////////
module b;
import std.stdio;
void foo( ) {
writeln( "Hi!" );
}
////////////////////
The above does not work (Error 42: Symbol Undefined _D1a3fooFZv).
Adding extern to foo in module b changes nothing. extern( C ) works,
but seems like a hack. Better ideas?
The issue is that the function called from module a is
_D1a3fooFZv where the function defined in module b is
_D1b3fooFZv ('a' <-> 'b') so they aren't the same function. extern(C) works
because C doesn't mangle names so the function is foo in both cases. You
can resolve this by having a a.di file with the extern foo(); in it (DMD
has a flag to generate such a file for you). OTOH without knowing what you
are doing, I can't tell if this is the correct solution.
--
... <IXOYE><