[Issue 13289] New: wchar and dchar C++ mangling is incorrect

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 12 23:02:44 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13289

          Issue ID: 13289
           Summary: wchar and dchar C++ mangling is incorrect
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: dra.open at gmail.com

Version: 2.065, 2.066.0-rc2

When I use written by C++ libraries,
compiled by MSVC++ libs are directly linkable if x64 environment
and enclosed in extern(C++).
I think dmd's name mangling is incorrect.

test.d
    extern(C++){
        void fc2(wchar){}
        void fc4(dchar){}
    }

test.cpp
    void fc2(wchar_t){}

obj by test.cpp

    cl 17.00.50727.1 (MSVC++) x86/x64
        void fc2(wchar_t) ?fc2@@YAX_W at Z void __cdecl fc2(wchar_t) // msvc

    dmc 8.42n x86
        void fc2(wchar_t) ?fc2@@YAX_Y at Z void __cdecl fc2(wchar_t) // dmc

obj by test.d

    dmd 2.065 x86/x64
        void fc2(wchar) ?fc2@@YAX_Y at Z void __cdecl fc2(wchar_t) // dmc
        void fc4(dchar) ?fc4@@YAXK at Z void __cdecl fc4(unsigned long)

    dmd 2.066.0-rc2 x86
        void fc2(wchar) ?fc2@@YAXG at Z void __cdecl fc2(unsigned short)
        void fc4(dchar) ?fc4@@YAX_Y at Z void __cdecl fc2(wchar_t) // dmc

    dmd 2.066.0-rc2 x64
        void fc2(wchar) ?fc2@@YAXG at Z void __cdecl fc2(unsigned short)
        void fc4(dchar) ?fc4@@YAX_W at Z void __cdecl fc4(wchar_t) // msvc

    desired mangle x86 (linkable obj by dmc)
        void fc2(wchar) ?fc2@@YAX_Y at Z void __cdecl fc2(wchar_t) // dmc
        void fc4(dchar) ?fc4@@YAXK at Z void __cdecl fc4(unsigned long)

    desired mangle x64 (linkable obj by msvc)
        void fc2(wchar) ?fc2@@YAX_W at Z void __cdecl fc2(wchar_t) // msvc
        void fc4(dchar) ?fc4@@YAXK at Z void __cdecl fc4(unsigned long)

2.0660-rc2 is wronger than 2.065

I think use wchar_t as wchar.

--


More information about the Digitalmars-d-bugs mailing list