diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-04-03 08:34:09 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-04-03 08:34:09 +0000 |
commit | 905bf499e48f6b556b714ac2033461aa4630fb05 (patch) | |
tree | ee95954a8821a8f5d6dee4abf29d872d30f56bca /ext | |
parent | 782a40f1181978d9bfe62418afdc2b6bc3857309 (diff) | |
download | perl-905bf499e48f6b556b714ac2033461aa4630fb05.tar.gz |
C++ compilation patch by Jarkko
p4raw-id: //depot/perl@30836
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Encode/bin/enc2xs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/Encode/bin/enc2xs b/ext/Encode/bin/enc2xs index 95067c8244..c5cf8eef36 100644 --- a/ext/Encode/bin/enc2xs +++ b/ext/Encode/bin/enc2xs @@ -271,6 +271,9 @@ if ($doC) # push(@{$encoding{$name}},outstring(\*C,$e2u->{Cname}.'_def',$erep)); } + my $cpp = ($Config{d_cplusplus} || '') eq 'define'; + my $exta = $cpp ? 'extern "C" ' : "static"; + my $extb = $cpp ? 'extern "C" ' : ""; foreach my $enc (sort cmp_name keys %encoding) { # my ($e2u,$u2e,$rep,$min_el,$max_el,$rsym) = @{$encoding{$enc}}; @@ -282,9 +285,9 @@ if ($doC) $sym =~ s/\W+/_/g; my @info = ($e2u->{Cname},$u2e->{Cname},"${sym}_rep_character",$replen, $min_el,$max_el); - print C "static const U8 ${sym}_rep_character[] = \"$rep\";\n"; - print C "static const char ${sym}_enc_name[] = \"$enc\";\n\n"; - print C "const encode_t $sym = \n"; + print C "${exta} const U8 ${sym}_rep_character[] = \"$rep\";\n"; + print C "${exta} const char ${sym}_enc_name[] = \"$enc\";\n\n"; + print C "${extb} const encode_t $sym = \n"; # This is to make null encoding work -- dankogai for (my $i = (scalar @info) - 1; $i >= 0; --$i){ $info[$i] ||= 1; |