Sisyphus [25/10/01 13:58 +1000]:
> Use of inherited AUTOLOAD for non-method main::mult_gcd() is deprecated at
> gcd_mult.pl line 55.
> Can't locate auto/main/mult_gcd.al in @INC (@INC contains: D:/pscrpt/inline
> /_Inline/lib D:/Perl/lib D:/Perl/site/lib .) at gcd_mult.pl line 55
> 
> Can someone enlighten me on the problem and possible solution ? They're
> fairly simple functions, and any explanation might help me in my
> understanding of both C and this module.

The cryptic message about the inherited AUTOLOAD is telling you that Perl
can't find the function 'main::mult_gcd()'. That tells you that Inline failed
to bind it to Perl. You can ask Inline what it's doing like this:

C:\> perl -MInline=force,info,noclean gcd_mult.pl
[trimmed]
The following Inline C function(s) have been successfully bound to Perl:
        int gcd(int x, int y)

Inline didn't bind to gcd_mult because it doesn't know how to bind to the C
type 'int *'. You have at least three ways to work around this: 

1. Don't use 'int *'. Change it to an array of scalars (AV *).
2. Don't use 'int *'. Change it to '...', which means to use the Perl stack.
3. Write a typemap file that converts either (1) or (2) into an array of
   integers.

There is an example of (2) in the Inline::C-Cookbook manpage. See 
'perldoc Inline::C-Cookbook' and look for 'Variable Argument Lists'.

There is no example of (1), but if you do it that way, maybe you could
write one :)

For information on (3), see 'perldoc perlxs' and look for the string 'example
typemap'. There's a reasonable example provided.

> This code has been copied, btw, and I'm not too sure what to do about the
> reference to 'ERROR' in the second function. I've tried deleting that 'if'
> statement entirely and it makes no difference. When I run this code in C, I
> change 'ERROR' to 'printf( "ERROR\n" )' and then the whole lot works fine -
> but 'Inline' seems to not like that change, complaining of '
> newline in constant' and 'syntax error : missing ')' ' in the .xs file.

You probably want the non-interpolated version of the here-doc quoting style:

use Inline Email => <<'END_OF_EMAIL';

This $ will not be interpolated. Neither will this \n.

Good luck!
Neil

END_OF_EMAIL

Reply via email to