diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2006-10-10 16:52:57 +0300 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-10-10 11:25:58 +0000 |
commit | 6e8dae779caa61392088d43ba93888dc57f1df7e (patch) | |
tree | 473a5ed8bd642bc49274cea002530a175e9158d9 /ext/Encode | |
parent | c3faea48927502248be7f55e1cfb047fff817fa8 (diff) | |
download | perl-6e8dae779caa61392088d43ba93888dc57f1df7e.tar.gz |
enc2xs and C++: add extern "C" to data
Message-ID: <452B7B89.201@iki.fi>
p4raw-id: //depot/perl@28980
Diffstat (limited to 'ext/Encode')
-rw-r--r-- | ext/Encode/bin/enc2xs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/Encode/bin/enc2xs b/ext/Encode/bin/enc2xs index 7665fa5b04..57d256ecd7 100644 --- a/ext/Encode/bin/enc2xs +++ b/ext/Encode/bin/enc2xs @@ -271,6 +271,8 @@ if ($doC) # push(@{$encoding{$name}},outstring(\*C,$e2u->{Cname}.'_def',$erep)); } + my $cpp = ($Config{d_cplusplus} || '') eq 'define'; + my $ext_c = $cpp ? 'extern "C" ' : ""; foreach my $enc (sort cmp_name keys %encoding) { # my ($e2u,$u2e,$rep,$min_el,$max_el,$rsym) = @{$encoding{$enc}}; @@ -282,9 +284,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 "${ext_c}static const U8 ${sym}_rep_character[] = \"$rep\";\n"; + print C "${ext_c}static const char ${sym}_enc_name[] = \"$enc\";\n\n"; + print C "${ext_c}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; |