Skip to content

Commit c37e40e

Browse files
committed
Update XSBUILD test to work when compiling under C++
1 parent b118178 commit c37e40e

File tree

1 file changed

+23
-3
lines changed
  • t/lib/MakeMaker/Test/Setup

1 file changed

+23
-3
lines changed

t/lib/MakeMaker/Test/Setup/XS.pm

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,16 +206,35 @@ $label2files{xsbuild} = +{
206206
},
207207
},
208208
),
209-
'lib/XS/Other.xs' => $XS_OTHER . <<EOF,
210-
\nint
209+
210+
'lib/XS/Other.xs' => <<EOF,
211+
#ifdef __cplusplus
212+
extern "C" { int plus1(int); }
213+
#endif
214+
$XS_OTHER
215+
int
211216
plus1(input)
212217
int input
213218
CODE:
214219
RETVAL = plus1(INVAR);
215220
OUTPUT:
216221
RETVAL
217222
EOF
218-
'lib/XS/plus1.c' => 'int plus1(i) int i; { return i + 1; }',
223+
224+
'lib/XS/plus1.c' => <<'EOF',
225+
#ifdef __cplusplus
226+
extern "C" {
227+
int plus1(int i)
228+
#else
229+
int plus1(i)
230+
int i;
231+
#endif
232+
{ return i + 1; }
233+
#ifdef __cplusplus
234+
}
235+
#endif
236+
EOF
237+
219238
't/is_odd.t' => <<'END',
220239
#!/usr/bin/perl -w
221240
use Test::More tests => 4;
@@ -224,6 +243,7 @@ ok is_odd(1);
224243
ok !is_odd(2);
225244
is XS::Other::plus1(3), 4;
226245
END
246+
227247
};
228248

229249
sub virtual_rename {

0 commit comments

Comments
 (0)