Hi Monks,

This weekend I've been studying perlxstut for play. since I've already had some experience of XS, I thought it would be a cozy research. But reality hurt me deeply, I took 5 more hours to study example 4, but there are still some questions make me headache (mainly about ExtUtils::MM):
And finally create a file Makefile.PL that looks like this: use ExtUtils::MakeMaker; $Verbose = 1; WriteMakefile( NAME => 'Mytest2::mylib', SKIP => [qw(all static static_lib dynamic dynamic_lib)], clean => {'FILES' => 'libmylib$(LIB_EXT)'}, ); sub MY::top_targets { ' all :: static pure_all :: static static :: libmylib$(LIB_EXT) libmylib$(LIB_EXT): $(O_FILES) $(AR) cr libmylib$(LIB_EXT) $(O_FILES) $(RANLIB) libmylib$(LIB_EXT) '; }
Above contents are makefile.PL in Mytest2/mylib subdir, my questions are
  1. As I understand, this makefile.PL just told make how to build static lib. so if libmylib is shared, can I just
    WriteMakefile( NAME => 'Mytest2::mylib', ); #no MY
  2. can I just write a makefile on Mystest/mylib or a Makefile.PL? too many parameters on EU::MM.
sub MY::postamble { ' $(MYEXTLIB): mylib/Makefile cd mylib && $(MAKE) $(PASSTHRU) '; }
Obove are some contents of Makefile.PL on Mytest2, my question are
  1. What is $(PASSTHRU)? I neither find it on EU::MM pod nor on make manpage, but I find a PASTHRU on makefile in mylib directory, is the same?
  2. Why when I run perl Makefile.PL on Mytest2 level, there also build a makefile on Mytest2/mylib directory? I don't see any command about this on Makefile.PL on Mytest2.
  3. Is there a standard way to write xs of access to a library? I lookup on cpan, like gtk2, EV and Tk, It seems there are own way to do.
  4. Is there a xs cookbook on internet? I think I now fully understand the underlying knowledge of xs and corresponding directives, but I hope there is a cookbook to lookup so I could avoid the pitfalls in the futures
TIA.

In reply to some questions about example 4 of perlxstut by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.