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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |