Mailing List Archive

C++ in xsubpp
I see that Ilya's patch for C++ made it into the xsubpp released with
5.002b1, but Dean's didn't.


First Ilya's patch. For those of you with short memories, Ilya's patch
changed this

# print initialization routine
print qq/extern "C"\n/ if $cplusplus;
print Q<<"EOF";
#XS(boot_$Module_cname)

to this

# print initialization routine
print Q<<"EOF";
##ifdef __cplusplus
#extern "C"
##endif
#XS(boot_$Module_cname)

i.e. C++ will be automatically be detected by the presence of the
"__cplusplus" macro, rather than by specifying the -C++ command line
option.

This now makes the C++ command line option redundant - that was the
only place it was used.

I can now do:

1. Leave the C++ option in place even thought it doesn't do
anything.
2. Remove it.
3. Make C++ unconditionally add the 'extern "C"' line. Say
something like below.

#print initialization routine
if ($cplusplus)
{ print qq/extern "C"\n/ }
else
{ print Q<<"EOF" }
##ifdef __cplusplus
#extern "C"
##endif
EOF

print Q<<"EOF";
#XS(boot_$Module_cname)


For now, I propose to do 1.


Next to Dean's patch. When xsubpp processes this:

static mytype *
classname::new()

it will generate this:

RETVAL = classname();

With Dean's patch it generates this:

RETVAL = new classname();

As nobody has objected to this proposed change, I intend to add it to
my copy of xsubpp and release it with the prototypes patch.

Any objections? - well speak up now please.

Paul