Brian Ingerson wrote:

> extern int squared(int);

This line (above) isn't even needed. 

Also, here's how to do it with more control:

----8<----
use Inline C => DATA => GLOBAL_LOAD => 0;
use Inline C => DATA => GLOBAL_LOAD => 1;

my ($a, $b) = @ARGV;

print "$a ^ 2 + $b ^ 2 = ", sum_squares($a, $b), "\n";

__END__

__C__
int sum_squares(int a, int b) {
    return squared(a) + squared(b);
}

__C__
int squared(int x) {
    return x * x;
}
----8<----

-- 
perl -le 'use Inline C=>q{SV*JAxH(char*x){return newSVpvf
("Just Another %s Hacker",x);}};print JAxH+Perl'

Reply via email to