Template mixin / unresolved external / scope problem?

Jacob Carlborg doob at me.com
Thu Nov 28 16:36:36 UTC 2019


On 2019-11-28 16:40, Robert M. Münch wrote:
> I have:
> 
> a.d:
> extern (C) void myFuncA();
> 
> void myFuncB() {
>      myFuncA();
> }
> 
> b.d:
> public import a;
> 
> mixin template MYFUNCA() {
>      extern (C) void myFuncA() {...}
> }
> 
> c.d:
> import b;
> 
> mixin MYFUNCA;
> ...further code...
> 
> 
> Compiling such a structure gives me an unresolved external in a.d/myFuncB
> 
> I assume this is because the mixin get's it's own scope. Is this 
> correct? How can I solve such a setup?

Are you using the latest version, 2.089.0? It might be fixed in that 
version [1].

[1] https://dlang.org/changelog/2.089.0.html#mixin_template_mangling

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list