digitalmars.D.learn - mixin template, extern(C/Windows) and mangled name
- Domain (15/15) Jul 31 2017 I known there is a bug with extern(C) in mixin template:
- Adam D. Ruppe (13/15) Jul 31 2017 main, DllMain, and WinMain are special cased...
- Domain (3/18) Jul 31 2017 Thanks. Anyone known any plan for issue 12575? It has been 3
I known there is a bug with extern(C) in mixin template: https://issues.dlang.org/show_bug.cgi?id=12575 And I can see SimpleDllMain in core.sys.windows.dll, the mangled name is correct: DllMain But my mixin template has wrong mangled name: mixin template GetMetaData() { extern(Windows) MetaData GetMetaData() { return MetaData(); } } mixin GetMetaData; I can see the mangled name is: _D3app8__mixin911GetMetaDataWZS4zero7plugins8metadata8MetaData
Jul 31 2017
On Tuesday, 1 August 2017 at 03:08:30 UTC, Domain wrote:And I can see SimpleDllMain in core.sys.windows.dll, the mangled name is correct: DllMainmain, DllMain, and WinMain are special cased... for yours, I think you'll have to hack it with pragma(mangle) mixin template GetMetaData() { pragma(mangle, "GetMetaData") // or whatever maybe 0 ? extern(Windows) MetaData GetMetaData() { return MetaData(); } } mixin GetMetaData; I think.
Jul 31 2017
On Tuesday, 1 August 2017 at 03:30:08 UTC, Adam D. Ruppe wrote:On Tuesday, 1 August 2017 at 03:08:30 UTC, Domain wrote:Thanks. Anyone known any plan for issue 12575? It has been 3 years, it looks like not that hard to fix.And I can see SimpleDllMain in core.sys.windows.dll, the mangled name is correct: DllMainmain, DllMain, and WinMain are special cased... for yours, I think you'll have to hack it with pragma(mangle) mixin template GetMetaData() { pragma(mangle, "GetMetaData") // or whatever maybe 0 ? extern(Windows) MetaData GetMetaData() { return MetaData(); } } mixin GetMetaData; I think.
Jul 31 2017