← Back to index
|
Original Bugzilla link
Bug 14951 – Win64: Invalid C++ mangling for __gshared pointer variables
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2015-08-23T15:37:00Z
Last change time
2015-09-05T07:42:32Z
Keywords
C++, pull
Assigned to
nobody
Creator
r.sagitario
Comments
Comment #0
by r.sagitario — 2015-08-23T15:37:48Z
Compile this file with the x64 MC compiler: // testcpp.cpp class ClassDeclaration { }; extern ClassDeclaration* ti2; class Type { public: static ClassDeclaration* typeinfovector; }; ClassDeclaration* foo() { return ti2 ? ti2 : Type::typeinfovector; } and link with // test.d extern(C++) class ClassDeclaration { } extern(C++) class Type { static __gshared ClassDeclaration typeinfovector; } extern(C++) __gshared ClassDeclaration ti2; extern(C++) ClassDeclaration* foo(); void main() { foo(); } /////////////////// cl /c testcpp.cpp dmd -m64 test.d testcpp.obj test.obj : error LNK2019: unresolved external symbol "class ClassDeclaration * * __cdecl foo(void)" (?foo@@YAPEAPEAVClassDeclaration@@XZ) referenced in function _Dmain testcpp.obj : error LNK2019: unresolved external symbol "class ClassDeclaration * ti2" (?ti2@@3PEAVClassDeclaration@@EA) referenced in function "class ClassDecl aration * __cdecl foo(void)" (?foo@@YAPEAVClassDeclaration@@XZ) testcpp.obj : error LNK2019: unresolved external symbol "public: static class Cl assDeclaration * Type::typeinfovector" (?typeinfovector@Type@@2PEAVClassDeclarat ion@@EA) referenced in function "class ClassDeclaration * __cdecl foo(void)" (?f oo@@YAPEAVClassDeclaration@@XZ) The dmd generated symbols are missing the "E" modifier for the pointer type: ?ti2@@3PEAVClassDeclaration@@A ?typeinfovector@Type@@2PEAVClassDeclaration@@A
Comment #1
by r.sagitario — 2015-08-23T17:06:52Z
https://github.com/D-Programming-Language/dmd/pull/4935
Comment #2
by r.sagitario — 2015-08-23T17:07:47Z
>extern(C++) ClassDeclaration* foo(); This is wrong, should not have the '*': >extern(C++) ClassDeclaration foo();
Comment #3
by github-bugzilla — 2015-08-23T18:55:19Z
Commit pushed to stable at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/d16e409431c6a73af8f4a92f512de1976f615b51
Merge pull request #4935 from rainers/issue14951 Fix issue 14951 - VC mangling for class reference/pointer
Comment #4
by github-bugzilla — 2015-08-29T08:02:20Z
Commit pushed to master at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/d16e409431c6a73af8f4a92f512de1976f615b51
Merge pull request #4935 from rainers/issue14951
Comment #5
by r.sagitario — 2015-09-05T07:42:32Z
not automatically closed.