Try 'xsubpp yourfile.xs' and you'll see
XS(XS_REGTEST_rcv_msg) { dXSARGS; if (items != 8) Perl_croak(aTHX_ "Usage: REGTEST::rcv_msg(query, queryLen, testHos +t, testPort, prodHost, prodPort, testMsg, prodMsg)"); { char * int char * char * char * char * char * + testMsg; char * prodMsg; int RETVAL; RETVAL = rcv_msg(query, queryLen, testHost, testPort, prodHost, pr +odPort, testMsg, prodMsg); } XSRETURN(1); }
XSRETURN(1) means it returns one. So XSRETURN(3) site:search.cpan.org and you'll find some examples, like
void GetBorders(handle) HWND handle PREINIT: int aBorders [3]; PPCODE: if(SendMessage(handle, SB_GETBORDERS, (WPARAM) 0, (LPARAM) aBorder +s) == TRUE) { EXTEND(SP,3); XST_mIV(0,aBorders[0]); XST_mIV(1,aBorders[1]); XST_mIV(2,aBorders[2]); XSRETURN(3); } else { XSRETURN_UNDEF; }
or
void tdxs_wait_for_response() PPCODE: I32 result = EM_OK; I32 sessid = 0; I32 token = 0; char *cnta = NULL; DBCHWAT(&result, cnta, &sessid, &token); EXTEND(SP, 3); if (result != EM_OK) { PUSHs(&PL_sv_undef); PUSHs(sv_2mortal(newSViv(result))); PUSHs(&PL_sv_undef); XSRETURN(3); } PUSHs(sv_2mortal(newSViv(sessid))); PUSHs(sv_2mortal(newSViv(0))); PUSHs(&PL_sv_undef); XSRETURN(3);

In reply to Re: Return list from C to PerlXS by Anonymous Monk
in thread Return list from C to PerlXS by libvenus

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.