Files
CMake/Tests/RunCMake/AutoExportDll/hello.cxx
T
Tolga Mizrak 607d9cf561 WINDOWS_EXPORT_ALL_SYMBOLS: Do not export C++ operators declared extern "C"
The pattern `extern "C" { inline bool operator==(...) {} }` appears
in at least one Windows SDK header, `winnt.h`.  Translation units that
instantiate the inline symbol produce object files with a symbol named
just `==`.  Avoid exporting such symbols because the linker will not
recognize them.

Fixes: #24999
2025-05-21 08:07:54 -04:00

54 lines
805 B
C++

#include "hello.h"
#include <stdio.h>
int Hello::Data = 0;
void Hello::real()
{
return;
}
void hello()
{
printf("hello");
}
void Hello::operator delete[](void*) {};
void Hello::operator delete(void*) {};
#ifdef HELLO_VFTABLE
HelloVFTable::HelloVFTable()
{
}
HelloVFTable::~HelloVFTable()
{
}
#endif
#ifndef __SUNPRO_CC
// C++ operators incorrectly declared extern "C" should *not* be exported.
extern "C" {
bool operator==(Hello const&, Hello const&)
{
return false;
}
bool operator!=(Hello const&, Hello const&)
{
return false;
}
bool operator<(Hello const&, Hello const&)
{
return false;
}
bool operator<=(Hello const&, Hello const&)
{
return false;
}
bool operator>(Hello const&, Hello const&)
{
return false;
}
bool operator>=(Hello const&, Hello const&)
{
return false;
}
}
#endif