Hi Fiftyvolts,

That XS file compiles fine for me on Win32 (perl 5.8.8) - and the resultant module tests fine.

I do note that I'm getting a slightly different C file. Here it is (in full):
/* * This file was generated automatically by ExtUtils::ParseXS version +2.17 from the * contents of Test.xs. Do not edit this file, edit Test.xs instead. * * ANY CHANGES MADE HERE WILL BE LOST! * */ #line 1 "Test.xs" #include "EXTERN.h" #include "perl.h" #include "XSUB.h" int add_one(int i) { return i + 1; } int add_two(int i) { return i + 1; } #ifndef PERL_UNUSED_VAR # define PERL_UNUSED_VAR(var) if (0) var = var #endif #line 28 "Test.c" XS(XS_Test_add_interface); /* prototype to pass -Wmissing-prototypes * +/ XS(XS_Test_add_interface) { #ifdef dVAR dVAR; dXSARGS; #else dXSARGS; #endif dXSFUNCTION(int); if (items != 1) Perl_croak(aTHX_ "Usage: %s(%s)", "Test::add_interface", "i"); PERL_UNUSED_VAR(cv); /* -W */ { int i = (int)SvIV(ST(0)); int RETVAL; dXSTARG; XSFUNCTION = XSINTERFACE_FUNC(int,cv,XSANY.any_dptr); RETVAL = XSFUNCTION(i); XSprePUSH; PUSHi((IV)RETVAL); } XSRETURN(1); } #ifdef __cplusplus extern "C" #endif XS(boot_Test); /* prototype to pass -Wmissing-prototypes */ XS(boot_Test) { #ifdef dVAR dVAR; dXSARGS; #else dXSARGS; #endif char* file = __FILE__; PERL_UNUSED_VAR(cv); /* -W */ PERL_UNUSED_VAR(items); /* -W */ XS_VERSION_BOOTCHECK ; { CV * cv ; cv = newXS("Test::add_two", XS_Test_add_interface, file); XSINTERFACE_FUNC_SET(cv,add_two) ; cv = newXS("Test::add_one", XS_Test_add_interface, file); XSINTERFACE_FUNC_SET(cv,add_one) ; } XSRETURN_YES; }
Btw, note that *both* add_one() and add_two() add *one*. (Had me stumped for a moment when I was testing the module, because I expected add_two() to add two and hadn't actually read the relevant code ... silly me :-)

Cheers,
Rob
Afterthought: Are you using the same compiler that was used to build perl ? If not, then could it be that your 'cc' is incompatible with the C code that's being generated ?

In reply to Re: perlxs INTERFACE problem by syphilis
in thread perlxs INTERFACE problem by Fiftyvolts

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.