Make the C++ test export the expected symbol

Use `namespace` instead of `class` and mark as `extern "C"`.
This commit is contained in:
Zakariyya Mughal 2023-09-14 17:11:13 -04:00 committed by Leon Timmermans
parent b2ccf6cf8e
commit b716ae24a5
2 changed files with 2 additions and 2 deletions

View File

@ -202,7 +202,7 @@ sub have_compiler {
binmode $FH;
if ( $is_cplusplus ) {
print $FH "class Bogus { public: int boot_compilet() { return 1; } };\n";
print $FH q<namespace Bogus { extern "C" int boot_compilet() { return 1; } };> . "\n";
}
else {
print $FH "int boot_compilet(void) { return 1; }\n";

View File

@ -33,7 +33,7 @@ ok $b->have_cplusplus, "have_cplusplus";
$source_file = File::Spec->catfile('t', 'cplust.cc');
{
open my $FH, '>', $source_file or die "Can't create $source_file: $!";
print $FH "class Bogus { public: int boot_cplust() { return 1; } };\n";
print $FH q<namespace Bogus { extern "C" int boot_cplust() { return 1; } };> . "\n";
close $FH;
}
ok -e $source_file, "source file '$source_file' created";