You might try:
At the top of your XS file
typedef struct timeval * TimeVal;
tout = INT2PTR(TimeVal,tmp);
int the typemap:
TimeVal T_PTROBJ
Medi Montaseri wrote:
>
> I am trying to use a RPC library called clnt_call in my XS.
> clnt_call() takes a timeout argument called tout of the type 'struct
> timeval'
> defined as
>
> struct timeval {
> time_t tv_sec; /* seconds */
> suseconds_t tv_usec; /* microseconds */
> };
>
> xsubpp(1) is having problem wanting me to define it in my 'typemap'
> file.
> How do I do that? If I just say
>
> struct timeval T_PTROBJ
>
> Then I get an error on line 117 of my RPC.c
>
> if (sv_derived_from(ST(4), "struct timeval")) {
> IV tmp = SvIV((SV*)SvRV(ST(4)));
> tout = INT2PTR(struct timeval,tmp);
> }
>
> Where line 117 is 'tout = INT2PTR'
> the error message reads
> RPC.c:117: conversion to non-scalar type requested
>
> Thanks
>
> --
> -------------------------------------------------------------------------
> Medi Montaseri [EMAIL PROTECTED]
> Unix Distributed Systems Engineer HTTP://www.CyberShell.com
> CyberShell Engineering
> -------------------------------------------------------------------------