Hi Ned,

You've hit a problem we're going to solve in Inline-0.44. If Inline doesn't
bind to _anything_, it will now emit a warning (you _do_ have warnings turned
on, right?).

Ned Konz [11/12/01 11:28 -0800]:
> However, I can't seem to get it to work. I'm using Inline 0.43 on Perl 5.6.1. 
> Can someone help? I've read the C-Cookbook and can't seem to find anything to 
> help.

In Inline::C-Cookbook, section "Meat & Potatoes", subsection "Using Memory",
there's the obfuscated hint you need:

$ perl -MInline=INFO,FORCE,NOCLEAN powerMonitor.pl

This will tell you what Inline actually bound to, leave the build directory
intact and tell you where to find it.

It's documented better in 'perldoc Inline'. Look in section "Using the
Inline.pm Module", subsection "Inline Shortcuts".

> I get this message when I run the program:
> 
> $ perl powerMonitor.pl
> Use of inherited AUTOLOAD for non-method main::allow_access() is deprecated 
> at powerMonitor.pl line 25.
> Can't locate auto/main/allow_acces.al in @INC (@INC contains: 
> /home/ned/.Inline/lib /usr/lib/perl5/5.6.1/i686-linux /usr/lib/perl5/5.6.1 
> /usr/lib/perl5/site_perl/5.6.1/i686-linux /usr/lib/perl5/site_perl/5.6.1 
> /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl/5.005 
> /usr/lib/perl5/site_perl .) at powerMonitor.pl line 25

This annoying message has plagued Inline from the start. Does anyone out
there know how to explicitly disallow inherited AUTOLOADs? I'd much rather
the script just crash.

> Here's the program:
> ----- cut ------
  [snipped]
> __DATA__
> __C__
> 
> #include <sys/io.h>
> 
> int allow_access(unsigned long base, unsigned long num)
> {
>       return ioperm(base, num, 1);
> }

Perl can't bind to functions with "unsigned long"-, "unsigned short"-, or
"unsigned char"-typed parameters. In other words, they're not in the system
typemap. You can write your own typemap, or do the conversion yourself:

    int allow_access(SV *b, SV* n) {
        unsigned long base = SvUV(base);
        unsigned long num  = SvUV(n);
        return ioperm(base, num, 1);
    }

You get the idea.

Later,
Neil

Reply via email to