[EMAIL PROTECTED] (Sisyphus) writes:
[...]
> SV * create_struct(SV * s, int v) {
> Card c, * cptr;
> cptr = &c;
> c.suit = s;
> c.value = v;
> printf("%s %d\n", SvPV_nolen(cptr->suit), cptr->value);
> return sv_setref_pv(newSViv(0), Nullch, cptr);
>
> }
[...]
> Maybe I've got 'create_struct()' returning something inappropriate ?
Yup- the storage allocated to Card c vanishes once the create_struct
function returns. You need to allocate memory for the Card (with
malloc() or some equivalent) and then have cptr point that location.
--
Joe Schaefer