Hello All,

Can anyone please help with using inline C in perl6 ? basically I want C
extensions in perl6.

This is what I tried..

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$

Please help..

Thanks & Regards,
Ashiva


Thanks & Regards,*
Ashraya S Shiva*


On Wed, Aug 7, 2013 at 6:15 PM, Will Coleda <w...@coleda.com> wrote:

> This question is better sent to perl6-users@perl.org - Inline::C doesn't
> exist in perl6, so even if you get past the error on the use statement,
> this isn't going to work as written.
>
>
>
> On Wed, Aug 7, 2013 at 12:23 AM, Ashraya <theemeralds...@gmail.com> wrote:
>
>> 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$
>>
>> Does anyone know anything about it ?
>>
>> Please reply.
>>
>> Thanks & Regards,*
>> Ashraya S Shiva*
>>
>
>
>
> --
> Will "Coke" Coleda
>

Reply via email to