Hi, Inline::C is working now without the NativeCall patch. https://github.com/FROGGS/p6-Inline-C/commit/554fbb99d0c3491c69263e8238d8df8957e63fe0
Cheers! Am 11.08.2013 11:24, schrieb Tobias Leich: > Hi, you are mixing up Perl 5 and Perl 6 code. > > Tools like h2xs won't work in the Perl 6 world, so do this instead: > > |#!/usr/bin/env perl6 > > use soft; > use Inline; > > my sub a_plus_b( Int $a, Int $b ) is inline('C') returns Int {' > DLLEXPORT int a_plus_b (int a, int b) { > return a + b; > } > '}| > This is actually an example code from Perl 6's Inline module [1]. > > Sadly, this will only work when a pull request got merged [2]. > After that, you would have to reinstall NativeCall and Inline via > panda [3]. > > [1] https://github.com/FROGGS/p6-Inline-C > [2] https://github.com/jnthn/zavolaj/pull/29 > [3] panda install NativeCall && panda install Inline > > Cheers, FROGGS > > =============================================================== > > From:*Ashraya* > Date: August 11, 2013 04:15 > Subject: Re: Problem in using inline C with perl6 > 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 > > >