Subject: | No Inline C functions bound to Perl |
Foo.pm looks like:
--------------------------
package Foo;
use Inline C => <<'END_OF_C_CODE';
double * foo() {
double a = 123.456, *x;
x = &a;
return x;
}
END_OF_C_CODE
1;
-------------------------
try.pl looks like:
-------------------------
#!perl -w
use Foo;
use Inline C => <<'EOC';
int silly() {
int x = 1234567890;
return x;
}
EOC
my $i = silly;
print $i, "\n";
-------------------------
When I run 'perl try.pl' then, assuming Foo.pm has not been previously
compiled, I get:
Warning. No Inline C functions bound to Perl
Check your C function definition(s) for Inline compatibility
1234567890
The message is misleading (clearly the 'silly' function is bound to
Perl) and should really name the file to which the warning relates.
I also feel that *any* function that doesn't bind to perl should be
explicitly named (including package name - eg 'Foo::foo'). This would
generally be of assistance, and an improvement to the Inline::C
diagnostics. Admittedly, one sometimes includes Inline C functions
that are not intended to bind to perl ... but that's the nature
of 'warnings' - they're telling you that there *might* be a problem,
not that that there definitely *is* a problem
If you happen to 'use warnings;' instead of running under the '-w'
switch, you don't even get to see that warning (because 'use
warnings;' doesn't set $^W). Not sure how to fix that. It's pointless
having C.pm check to see whether the warnings module has been loaded -
it invariably has been loaded, presumably by one of the other modules
that Inline loads in. Perhaps that warning should appear, irrespective
of whether the user has requested warnings or not ?
I'm using inline-0.44, perl-5.8.8, on Windows 2000.
Cheers,
Rob