Tels <[EMAIL PROTECTED]> writes:
>
>Now, instead of malloc() a struct like:
>
> struct BigInt {
> int flags;
> int sign;
> double P;
> double A;
> SV* CALC;
> };
>
>and then putting a ptr to it into the PV slot, I thought I could:
As I have said (at least twice recently) you can naturally do one of two things:
1. Get perl to Newz() you a struct in the PV
e.g.
SV *thing = newSV(sizeof(struct BigInt));
struct BigInt *p = (struct BigInt *) SvPVX(sv);
I usually add:
SvPOK_only(sv);
SvREADONLY_on(sv);
OR
2. malloc() struct and put it in the IV
e.g.
struct BigInt *p = (struct BigInt *) malloc(sizeof(struct BitInt));
SV *thing = newSViv(PTR2IV(p));
DO NOT malloc() and put in PV slot.
Then your input and output typemaps need to match eachother.