$self->{typemap} = process_typemaps( $args{typemap}, $pwd );
- # Since at this point we're ready to begin printing to the output file and
- # reading from the input file, I want to get as much data as possible into
- # the proto-object $self. That means assigning to $self and elements of
- # %args referenced below this point.
- # HOWEVER: This resulted in an error when I tried:
- # $args{'s'} ---> $self->{s}.
- # Use of uninitialized value in quotemeta at
- # .../blib/lib/ExtUtils/ParseXS.pm line 733
-
+ # Move more settings from parameters to object
foreach my $datum ( qw| argtypes except inout optimize | ) {
$self->{$datum} = $args{$datum};
}
+ $self->{strip_c_func_prefix} = $args{s};
# Identify the version of xsubpp used
print <<EOM;
print "THIS->";
}
}
- $self->{func_name} =~ s/^\Q$args{'s'}//
- if exists $args{'s'};
+ my $strip = $self->{strip_c_func_prefix};
+ $self->{func_name} =~ s/^\Q$strip//
+ if defined $strip;
$self->{func_name} = 'XSFUNCTION' if $self->{interface};
print "$self->{func_name}($self->{func_args});\n";
}
my %args = ();
-my $usage = "Usage: xsubpp [-v] [-csuffix csuffix] [-except] [-prototypes] [-noversioncheck] [-nolinenumbers] [-nooptimize] [-noinout] [-noargtypes] [-s pattern] [-typemap typemap]... file.xs\n";
+my $usage = "Usage: xsubpp [-v] [-csuffix csuffix] [-except] [-prototypes] [-noversioncheck] [-nolinenumbers] [-nooptimize] [-noinout] [-noargtypes] [-strip|s pattern] [-typemap typemap]... file.xs\n";
Getopt::Long::Configure qw(no_auto_abbrev no_ignore_case);
v
typemap=s@
output=s
- s=s
+ s|strip=s
csuffix=s
))
or die $usage;
many versions of perl, at least as far back as perl5.003_07. It's
allowed here for backwards compatibility.
+=item B<-s=...> or B<-strip=...>
+
+I<This option is obscure and discouraged.>
+
+If specified, the given string will be stripped off from the beginning
+of the C function name in the generated XS functions (if it starts with that prefix).
+This only applies to XSUBs without C<CODE> or C<PPCODE> blocks.
+For example, the XS:
+
+ void foo_bar(int i);
+
+when C<xsubpp> is invoked with C<-s foo_> will install a C<foo_bar>
+function in Perl, but really call C<bar(i)> in C. Most of the time,
+this is the opposite of what you want and failure modes are somewhat
+obscure, so please avoid this option where possible.
+
=back
=head1 ENVIRONMENT