www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23660] New: DMD doesn't emit ABI-compatible extern(C++) thunks

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

          Issue ID: 23660
           Summary: DMD doesn't emit ABI-compatible extern(C++) thunks
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

Test added by issue 15579 has been reverted.

c++ -m64 -c runnable_cxx/extra-files/cppb.cpp -o
test_results/runnable_cxx/cppb.cpp.o -std=c++11

dmd -m64 -Irunnable_cxx -preview=in -checkaction=C  -fPIC -L-lstdc++
-L--no-demangle  -odtest_results/runnable_cxx
-oftest_results/runnable_cxx/cppa_0  runnable_cxx/cppa.d
test_results/runnable_cxx/cppb.cpp.o 

Result in linker error:
---
test_results/runnable_cxx/cppb.cpp.o:cppb.cpp:_ZTV7Derived: error: relocation
refers to global symbol "_ZThn16_N7Derived7MethodDEv", which is defined in a
discarded section
  section group signature: "_ZN7Derived7MethodDEv"
  prevailing definition is from test_results/runnable_cxx/cppa_0.o
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
---

GDC and LDC do not have the same problem, they emit extern(C++) thunks with C++
mangling.

--
Jan 29 2023