I am just testing out Inline to see how it works
for building unimplemented system calls.
On many unix systems there is a clock system call
which is not implemented in perl. Here is my test on
Redhat linux 6.2 to implment it using Inline:
$ cat try.pl
#!/usr/local/bin/perl
use Inline C => DATA =>
PREFIX => 'my_';
my $start_time=clock();
my $a=1;
for (my $i=0; $i<=1000000; $i++) {
$a=exp(log(tan(atan($a))))+1.0;
}
print "\$a=$a\n";
my $end_time=clock();
print "\$end_time=$end_time\n";
print "elapsed time is ",$end_time-$start_time,"\n";
__END__
__C__
#include <time.h>
int my_clock(void) {
return clock();
}
But when I run it I got
$ try.pl
Can't locate auto/main/clock.al in @INC (@INC contains: /q/home/richard/_Inline/lib
/usr/local/lib/perl5/5.6.1/i686-linux /usr/local/lib/perl5/5.6.1
/usr/local/lib/perl5/site_perl/5.6.1/i686-linux /usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl/5.6.0/i686-linux /usr/local/lib/perl5/site_perl/5.6.0
/usr/local/lib/perl5/site_perl .) at ./try.pl line 5
What is the cause of this? Do I need to include special libraries?
A plain c code doesn't need that.
Thanks for any info
Richard