linker error

Tobias Pankrath tobias at pankrath.net
Mon Jul 9 07:29:53 PDT 2012


> Now it works! I added "extern(C)" to both declaration and 
> implementation of "implementThis". Thank you, Tobias.

No problem. What are you planning to do anyway? It seems that you 
want to have loose coupling between the modules since you don't 
just import the prove00.d.

Using the linker for this seems rather fragile and I don't think 
this approach will scale with multiple implementations. Using D 
you could consider doing something along these lines:

A.d:
void callThis(alias callee, Args ...) { callee(Args); }

B.d:
void implThis(string foo) { writeln(foo); }

callThis!(implThis)("bar");

Not tested.


More information about the Digitalmars-d-learn mailing list