How do I make an extern function?

Simen kjaeraas simen.kjaras at gmail.com
Mon Jun 28 17:51:09 PDT 2010


////////////////////
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?
-- 
Simen


More information about the Digitalmars-d-learn mailing list