Your SlideShare is downloading. ×
0
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
5分で始める XS - tsukuba.xs#1
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

5分で始める XS - tsukuba.xs#1

723

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
723
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 5 XS Tsukuba.xs Beer Talks #1 xaicron 2010 7 24
  • 2. • @xaicron • http://blog.livedoor.jp/xaicron/ • XS 2010 7 24
  • 3. 2010 7 24
  • 4. 2010 7 24
  • 5. • • PL_Cehck Hack • Perl • /* Polyglot */ • VM 2010 7 24
  • 6. 2010 7 24
  • 7. XS 2010 7 24
  • 8. C 2010 7 24
  • 9. • make, gcc C • Module::Install::XSUtil 2010 7 24
  • 10. $ h2xs -A -b 5.8.1 -n Foo::Bar $ cd Foo-Bar $ tree . |-- Bar.xs |-- Changes |-- MANIFEST |-- Makefile.PL |-- README |-- lib | `-- Foo | `-- Bar.pm |-- ppport.h `-- t `-- Foo-Bar.t 2010 7 24
  • 11. make && make test $ perl Makefile.PL $ make && make test 2010 7 24
  • 12. 2010 7 24
  • 13. 2010 7 24
  • 14. Makefile.PL use inc::Module::Install; use Module::Install::XSUtil; name 'Foo-Bar'; all_from 'lib/Foo/Bar.pm'; use_ppport 3.19; cc_warnings; cc_src_paths qw(xs); tests 't/*.t'; test_requires 'Test::More'; auto_include; WriteAll; 2010 7 24
  • 15. $ rm ppport.h $ mkdir xs $ mv Bar.xs xs $ tree . |-- Changes |-- MANIFEST |-- Makefile.PL |-- README |-- lib | `-- Foo | `-- Bar.pm |-- t | `-- Foo-Bar.t `-- xs `-- Bar.xs 2010 7 24
  • 16. xs/Bar.xs #define PERL_NO_GET_CONTEXT #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" MODULE = Foo::Bar PACKAGE = Foo::Bar PROTOTYPES: DISABLE int sum(int x, int y) CODE: RETVAL = x + y; OUTPUT: RETVAL 2010 7 24
  • 17. $ perl Makefile.PL $ make $ perl -Mblib -MFoo::Bar -le “print Foo::Bar::sum(1 ,2)” 3 2010 7 24
  • 18. 2010 7 24
  • 19. XS 2010 7 24
  • 20. Foo::Bar / Foo::Baz xs 2010 7 24
  • 21. $ h2xs -A -b 5.8.1 -n Foo::XS 2010 7 24
  • 22. • xs/Bar.xs, xs/Baz.xs • foo.h • xs/XS.xs • lib/Foo/Bar.pm, lib/Foo/Baz/pm 2010 7 24
  • 23. xs/Bar.xs #define PERL_NO_GET_CONTEXT #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" MODULE = Foo::Bar PACKAGE = Foo::Bar PROTOTYPES: DISABLE int sum(int x, int y) CODE: RETVAL = x + y; OUTPUT: RETVAL 2010 7 24
  • 24. xs/Baz.xs #define PERL_NO_GET_CONTEXT #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" MODULE = Foo::Baz PACKAGE = Foo::Baz PROTOTYPES: DISABLE int double(int x) CODE: RETVAL = x * 2; OUTPUT: RETVAL 2010 7 24
  • 25. foo.h 2010 7 24
  • 26. xs/XS.xs #define PERL_NO_GET_CONTEXT #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" #include "foo.h" MODULE = Foo::XS BOOT: FOO_CALL_BOOT(Foo__Bar); FOO_CALL_BOOT(Foo__Baz); 2010 7 24
  • 27. Foo/Bar.pm Foo/Baz.pm package Foo::Bar; # or Baz use strict; use warnings; use Foo::XS; our $VERSION = ‘0.01’; 1; 2010 7 24
  • 28. $ perl Makefile.pl $ make test $ perl -Mblib -MFoo::Bar -le “print Foo::Bar::sum(1,2)” 3 $ perl -Mblib -MFoo::Baz -le “print Foo::Baz::double(1)” 2 2010 7 24
  • 29. 2010 7 24
  • 30. • C XS • SV typemap 2010 7 24

×