Re: Problem in using inline C with perl6

[email protected] Thu, 8 Aug 2013 18:07:03 +1000
Newsgroups perl.inline
Message-ID <6D8C0FADCED34733A91071E8E9C5FF07@OwnerPC311012>
From: Ashraya
Sent: Wednesday, August 07, 2013 2:23 PM
To: [email protected] ; Duke Leto ; Will Coleda
Subject: Problem in using inline C with perl6

> Hi All,
>
> I am trying to use the C extention feature with perl6. Although it worked 
> fine with perl5, the C extention is different from perl5 to perl6. I tried 
> to use the same as following :
>
>
> h2xs -PAXn Math::Simple
>
> ashiva@ubuntu:~/Parrot/rakudo/Inline-0.44/Math-Simple$ cat math.pl
> #!/usr/bin/perl6
>
> use lib './lib/Math/.';
> use Math::Simple;
>
> print add(2, 3);
> print subtract(3, 2);
> ashiva@ubuntu:~/Parrot/rakudo/Inline-0.44/Math-Simple$
>
> ashiva@ubuntu:~/Parrot/rakudo/Inline-0.44/Math-Simple$ cat 
> lib/Math/Simple.pm
> package Math::Simple;
> $VERSION = '1.23';
>
> use base 'Exporter';
> @EXPORT_OK = qw(add subtract);
> use strict;
>
> use Inline C => 'DATA',
>            VERSION => '1.23',
>            NAME => 'Math::Simple';
>
> 1;
>
> __DATA__
>
> =pod
>
> =cut
>
> __C__
> int add(int x, int y) {
>   return x + y;
> }
>
> int subtract(int x, int y) {
>   return x - y;
> }
>
>
> But I keep getting this error :
>
> ashiva@ubuntu:~/Parrot/rakudo/Inline-0.44/Math-Simple$ perl6 math.pl
> ===SORRY!===
> arglist case of use not yet implemented. Sorry.
> at math.pl:3
> ashiva@ubuntu:~/Parrot/rakudo/Inline-0.44/Math-Simple$

I know virtually nothing about perl6, but it would seem that the error is in 
relation to:

use lib './lib/Math/.';

(Providing args such as './lib/Math/.' to a "use" directive is apparently 
not yet supported.)

So the error really has nothing to do with Inline itself.

I was told a few years ago that perl6 doesn't have XS. That being so, I 
don't see how Inline::C (in its current form) could ever work with perl6 - 
because, under the hood, Inline::C does little more than write (and compile) 
an XS file.

Cheers,
Rob