Ned Konz wrote:
> 
> On Wednesday 23 May 2001 10:10, you wrote:
> 
> > Sorry bout that. But I swear I've seen your name before. clp.misc maybe?
> 
> Probably clp.modules. I'm the author of the CPAN modules Archive::Zip and
> Algorithm::Diff.

Cool. I may make use of Archive::Zip in a future Inline. (To create
binary distributions in with a single command) 

> > So I still want to know. "Does it work?"
> 
> Well, that's a bit involved. Seems that the ioctl it's calling is failing...
> I _can_ try the technique for the sake of your Cookbook in a toy program...

I just had to know... :)

This works just great:

---8<---
use Inline C;

my ($foo, $bar);
change($foo, $bar);

print "\$foo = $foo\n";
print "\$bar = $bar\n";

__END__
__C__

int change(SV* var1, SV* var2) {
    sv_setpvn(var1, "Ned Konz Rocks!", 15);
    sv_setpvn(var2, "Inline Rules!", 13);
    return 1;
}
---8<---

I think if you want to pass back values, you'd better stick to SV*.
Other types would get messed up in the mapping code. Fortunately with
SV* you have complete control.

I'm very glad to know this. I'll definitely teach it in my conference
tutorials this summer.

Cheers, Brian

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

Reply via email to