Hi Monks

I m trying to call a C function stored in a library via perlXS. The signature of the C function is as under and the last two parameters are ouput parameters and contain a list

int rcv_msg(char *query, int readlen, char *testHost, char *testPort, +char *prodHost, char *prodPort, char *testMsg, char *prodMsg)

The XS code is as under :-

#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" #include "const-c.inc" MODULE = REGTEST PACKAGE = REGTEST INCLUDE: const-xs.inc int rcv_msg(query,queryLen,testHost,testPort,prodHost,prodPort,testMsg,pro +dMsg) char *query int queryLen char *testHost char *testPort char *prodHost char *prodPort char *testMsg = NO_INIT char *prodMsg = NO_INIT OUTPUT: testMsg prodMsg RETVAL

The c fuction returns a list value (i.e. the o/p of the query). I m not sure how do i store the list value in XS

the Perl code is as under :-

use ExtUtils::testlib; use REGTEST; local $/ = undef; my $query = "select symbol from SEC where symbol=\'IBM\'\;"; my $queryLen = split//,$query; my $testHost = "pisas392"; my $testPort = 50071; my $prodHost = "pisas392"; my $prodPort = 50071; my ($prodRes,$testRes); ($testRes,$prodRes) = REGTEST::rcv_msg($query,$queryLen,$testHost,$tes +tPort,$pro dHost,$prodPort,$testRes,$prodRes);

Any help is highly appreciated Thanks


In reply to 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.