Hi gurus,
I intend to dive into mysterious XS field. But my first try failed.;( Below is head and C files.
test.h #define TESTVAL 3 extern int max(int, int); test.c #include "./test.h" int max(int a, int b) { return ((a>b)? a:b); }
I ran 4 steps as perldoc h2xs: All things look fine, but when I run dmake, it throws error:
C:\Mytest>perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for Mytest C:\Mytest>dmake cp lib/Mytest.pm blib\lib\Mytest.pm AutoSplitting blib\lib\Mytest.pm (blib\lib\auto\Mytest) C:\strawberry\perl\bin\perl.exe C:\strawberry\perl\lib\ExtUtils\xsubpp + -typemap C:\strawberry\perl\lib\ExtUtils\typemap Mytest.xs > Mytest.xsc && C: +\strawberr y\perl\bin\perl.exe -MExtUtils::Command -e "mv" -- Mytest.xsc Mytest.c Please specify prototyping behavior for Mytest.xs (see perlxs manual) gcc -c -I. -s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE - +DPERL_IMPL ICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -DPERL_MSVCRT_RE +ADFIX -s - O2 -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" "-IC:\strawberr +y\perl\lib \CORE" Mytest.c In file included from Mytest.xs:7: ./test.h:1: error: syntax error before "int" dmake: Error code 129, while making 'Mytest.o'
Any thoughts? I believe monks' help will let me pass Dark Ages as quickly as possible. ;) TIA




I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction


In reply to How convert header file to XS by h2xs? by xiaoyafeng

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.