https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111100

            Bug ID: 111100
           Summary: Use extern "C" for __gcov_dump and related functions
                    in gcov.h
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: carlosgalvezp at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Hi!

The documentation of GCOV mentions that users can use __gcov_dump and
__gcov_reset. This comes from gcov.h.

The problem is that we currently can't use them in C++ code, because they don't
have extern "C" declaration. Therefore the names are mangled which leads to
linking errors (undefined reference) when using the code.

As a workaround, people need to re-create gcov.h on their own to add the extern
"C" declaration, or include the header under an extern "C" block, which is not
very clean.

Would it be possible to add extern "C" to the declarations in gcov.h?

Thanks
  • [Bug gcov-profile/111100] New:... carlosgalvezp at gmail dot com via Gcc-bugs

Reply via email to