Thread overview | |||||
---|---|---|---|---|---|
|
January 12, 2016 Declaring extern(C) declarations with template mixins | ||||
---|---|---|---|---|
| ||||
Is this supposed to work: template Foo() { extern(C) int printf(in char*, ...); } mixin Foo; void main() { printf("foo\n"); } It fails with a linker error, undefined symbol, due to not applying C mangling: Undefined symbols for architecture x86_64: "__D4main8__mixin76printfUxPaYi", referenced from: __Dmain in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) -- /Jacob Carlborg |
January 12, 2016 Re: Declaring extern(C) declarations with template mixins | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Tuesday, 12 January 2016 at 21:22:46 UTC, Jacob Carlborg wrote: > Is this supposed to work: > > template Foo() > { > extern(C) int printf(in char*, ...); > } > > mixin Foo; > > void main() > { > printf("foo\n"); > } > > It fails with a linker error, undefined symbol, due to not applying C mangling: > > Undefined symbols for architecture x86_64: > "__D4main8__mixin76printfUxPaYi", referenced from: > __Dmain in main.o > ld: symbol(s) not found for architecture x86_64 > clang: error: linker command failed with exit code 1 (use -v to see invocation) https://issues.dlang.org/show_bug.cgi?id=12575 |
January 13, 2016 Re: Declaring extern(C) declarations with template mixins | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mathias Lang | On 2016-01-12 22:27, Mathias Lang wrote: > https://issues.dlang.org/show_bug.cgi?id=12575 Thanks. -- /Jacob Carlborg |
Copyright © 1999-2021 by the D Language Foundation